get() ) ) { $result = call_user_func_array( $fn, $args ); Cache::set( $group, $key, $result ); return $result; } return $result->get(); }; } ) ); self::macro( 'memorize', self::memorizeWithCheck( Fns::__, Fns::always( true ), Fns::__ ) ); } /** * @param string $group * @param string $key * * @return \WPML\FP\Just|\WPML\FP\Nothing */ public static function getInternal( $group, $key ) { $found = false; $result = wp_cache_get( $key, $group, false, $found ); if( $found && is_array( $result ) && array_key_exists( 'data', $result ) ) { return Maybe::just( $result['data'] ); } return Maybe::nothing(); } /** * @param string $group * @param string $key * @param mixed $value * * @return bool|true */ public static function setInternal( $group, $key, $value ) { // Save $value in an array. We need to do this because W3TC and Redis have bug with saving null. return wp_cache_set( $key, [ 'data' => $value ], $group ); } } Cache::init();