Configuration 'enabled' => true, // Boolean,optional, true by default 'cacheAdapter' => 'redis', // Required if option 'enabled' set to true 'tagAdapter' => 'memcached', // Optional 'settings' => [ 'redis' => [], // Settings for setup Instance of Bluz\Cache\CacheInterface. 'memcached' => [], // Settings for another cache adapter ]
Inheritance: implements Bluz\Cache\CacheInterface, implements Bluz\Cache\TagableInterface, use trait Bluz\Common\Options
Ejemplo n.º 1
0
 /**
  * Init instance
  *
  * @return Instance
  */
 protected static function initInstance()
 {
     $config = Config::getData('cache');
     if (!$config || !isset($config['enabled']) || !$config['enabled']) {
         return new Nil();
     } else {
         $instance = new Instance();
         $instance->setOptions($config);
         return $instance;
     }
 }
Ejemplo n.º 2
0
 /**
  * Cache Throws Exception for invalid configuration
  * @expectedException \Bluz\Common\Exception\ConfigurationException
  */
 public function testCacheWithEmptyConfigurationThrowsException()
 {
     $cache = new Cache();
     $cache->setOptions(array());
 }