示例#1
0
 /**
  * @param string $directory
  */
 function __construct($directory = null)
 {
     if ($directory === null) {
         $directory = sys_get_temp_dir();
     }
     $driver = new FilesystemCache($directory);
     parent::__construct($driver);
 }
示例#2
0
 /**
  * @param array  $servers Array of servers, where each server entry is in format array(SERVER_IP, SERVER_PORT, SERVER_WEIGHT), where SERVER_WEIGHT is optional (the bigger value, the bigger there is chance to be connected to that server).
  * @param string $prefix  Prefix for all the keys stored in memcached using this adapter.
  */
 public function __construct(array $servers, $prefix)
 {
     $driver = new MemcachedCache();
     $memcached = new \Memcached();
     $memcached->addServers($servers);
     $memcached->setOption(\Memcached::OPT_PREFIX_KEY, $prefix);
     $driver->setMemcached($memcached);
     $this->driver = $driver;
     parent::__construct($driver);
 }