public function __construct(&$xpdo, $options = array())
 {
     parent::__construct($xpdo, $options);
     if (class_exists('Memcache', true)) {
         $this->memcache = new Memcache();
         if ($this->memcache) {
             $servers = explode(',', $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
             foreach ($servers as $server) {
                 $server = explode(':', $server);
                 $this->memcache->addServer($server[0], (int) $server[1]);
             }
             $compressThreshold = $this->getOption($this->key . '_memcached_compress_threshold', $options, $this->getOption('memcached_compress_threshold', array(), '20000:0.2'));
             if (!empty($compressThreshold)) {
                 $threshold = explode(':', $compressThreshold);
                 if (count($threshold) == 2) {
                     $minValue = (int) $threshold[0];
                     $minSaving = (double) $threshold[1];
                     if ($minSaving >= 0 && $minSaving <= 1) {
                         $this->memcache->setCompressThreshold($minValue, $minSaving);
                     }
                 }
             }
             $this->initialized = true;
         } else {
             $this->memcache = null;
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOMemCache[{$this->key}]: Error creating memcache provider for server(s): " . $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
         }
     } else {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOMemCache[{$this->key}]: Error creating memcache provider; xPDOMemCache requires the PHP memcache extension.");
     }
 }
 public function __construct(& $xpdo, $options = array()) {
     parent :: __construct($xpdo, $options);
     if (function_exists('wincache_ucache_info')) {
         $this->initialized = true;
     } else {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOWinCache[{$this->key}]: Error creating wincache provider; xPDOWinCache requires the PHP wincache extension, version 1.1.0 or later.");
     }
 }
 public function __construct(& $xpdo, $options = array()) {
     parent :: __construct($xpdo, $options);
     if (function_exists('apc_exists')) {
         $this->initialized = true;
     } else {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOAPCCache[{$this->key}]: Error creating APC cache provider; xPDOAPCCache requires the APC extension for PHP, version 2.0.0 or later.");
     }
 }
 public function __construct(&$xpdo, $options = array())
 {
     parent::__construct($xpdo, $options);
     if (class_exists('Memcached', true)) {
         $this->memcached = new Memcached();
         if ($this->memcached) {
             $servers = explode(',', $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
             foreach ($servers as $server) {
                 $server = explode(':', $server);
                 $this->memcached->addServer($server[0], (int) $server[1]);
             }
             $this->memcached->setOption(Memcached::OPT_COMPRESSION, (bool) $this->getOption($this->key . '_memcached_compression', $options, $this->getOption('memcached_compression', $options, $this->getOption(Memcached::OPT_COMPRESSION, $options, true))));
             $this->initialized = true;
         } else {
             $this->memcached = null;
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOMemCached[{$this->key}]: Error creating memcached provider for server(s): " . $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
         }
     } else {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOMemCached[{$this->key}]: Error creating memcached provider; xPDOMemCached requires the PHP memcached extension.");
     }
 }
Beispiel #5
0
 public function getCacheKey($key, $options = array())
 {
     $cachePath = $this->getOption('cache_path', $options);
     $cacheExt = $this->getOption('cache_ext', $options, '.cache.php');
     $key = parent::getCacheKey($key, $options);
     return $cachePath . $key . $cacheExt;
 }