Esempio n. 1
0
 /**
  * {@inheritdoc}
  *
  * @param DriverInterface $driver  Pre-created driver instance.
  * @param bool            $connect If true, custom driver will be connected.
  * @throws StoreException
  */
 public function __construct(CacheProvider $cache, DriverInterface $driver = null, $connect = true)
 {
     parent::__construct($cache);
     if (is_object($driver)) {
         $this->setDriver($driver, $connect);
         return;
     }
     if (empty($this->options['servers'])) {
         throw new StoreException('Unable to create Memcache[d] cache store. A lest one server must be specified.');
     }
     //New Driver creation
     if (class_exists('Memcache')) {
         $this->setDriver(new MemcacheDriver($this->options), true);
     }
     if (class_exists('Memcached')) {
         $this->setDriver(new MemcachedDriver($this->options), true);
     }
     if (empty($this->driver)) {
         throw new StoreException('No available Memcache drivers found.');
     }
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(CacheProvider $cache)
 {
     parent::__construct($cache);
     $this->driver = function_exists('apcu_store') ? self::APCU_DRIVER : self::APC_DRIVER;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  *
  * @param FilesInterface $files
  */
 public function __construct(CacheProvider $cache, FilesInterface $files)
 {
     parent::__construct($cache);
     $this->files = $files;
 }