Beispiel #1
0
 public function detectClass()
 {
     foreach ($this->map as $func => $class) {
         if (function_exists($func)) {
             if ('apcu_fetch' === $func && !apcu_enabled()) {
                 continue;
             }
             return $class;
         }
     }
     return 'xpl\\Cache\\Driver\\MemoryDriver';
 }
Beispiel #2
0
 public static function isAvailable()
 {
     return function_exists('apcu_enabled') && apcu_enabled();
 }
Beispiel #3
0
 public static function detectDriverClass()
 {
     if (function_exists('apcu_fetch')) {
         if (ini_get('apc.enabled') && (PHP_SAPI !== 'cli' || ini_get('apc.enable_cli'))) {
             return 'WordPress\\Cache\\Driver\\Apcu';
         }
     }
     if (function_exists('xcache_get')) {
         return 'WordPress\\Cache\\Driver\\XCache';
     }
     return 'WordPress\\Cache\\Driver\\Memory';
     $map = array('apcu_fetch' => 'WordPress\\Cache\\Driver\\Apcu', 'apc_fetch' => 'WordPress\\Cache\\Driver\\Apc', 'xcache_get' => 'WordPress\\Cache\\Driver\\XCache', 'serialize' => 'WordPress\\Cache\\Driver\\Memory');
     foreach ($map as $func => $class) {
         if (function_exists($func)) {
             if ('apcu_fetch' === $func && !apcu_enabled()) {
                 continue;
             }
             $driverClass = $class;
             break;
         }
     }
     return new $driverClass();
 }
Beispiel #4
0
 public function isEnable()
 {
     return function_exists('apcu_enabled') && apcu_enabled();
 }