Exemplo n.º 1
0
 protected function init($args)
 {
     parent::init($args);
     $this->mem = new Memcache();
     if (!isset($args['CACHE_HOST'])) {
         throw new KurogoConfigurationException("Memcache host is not defined");
     } else {
         $host = $args['CACHE_HOST'];
     }
     if (!isset($args['CACHE_PORT'])) {
         $port = 11211;
     } else {
         $port = $args['CACHE_PORT'];
     }
     if (!isset($args['CACHE_PERSISTENT'])) {
         $persistent = false;
     } else {
         $persistent = (bool) $args['CACHE_PERSISTENT'];
     }
     if (!isset($args['CACHE_TIMEOUT'])) {
         $timeout = 1;
     } else {
         $timeout = (int) $args['CACHE_TIMEOUT'];
     }
     if (isset($args['CACHE_COMPRESSED'])) {
         $this->setCompressed($args['CACHE_COMPRESSED']);
     } else {
         $this->setCompressed(true);
     }
     if (isset($args['CACHE_DEBUG'])) {
         $this->setDebug($args['CACHE_DEBUG']);
     } else {
         $this->setDebug(false);
     }
     if ($persistent) {
         $result = @$this->mem->pconnect($host, $port, $timeout);
     } else {
         $result = @$this->mem->connect($host, $port, $timeout);
     }
     if (!$result) {
         throw new KurogoConfigurationException("Memcache server {$host} not available");
     }
 }
Exemplo n.º 2
0
 public static function getCacheClasses()
 {
     includePackage('Cache');
     return KurogoCache::getCacheClasses();
 }