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
]
/** * 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; } }
/** * Cache Throws Exception for invalid configuration * @expectedException \Bluz\Common\Exception\ConfigurationException */ public function testCacheWithEmptyConfigurationThrowsException() { $cache = new Cache(); $cache->setOptions(array()); }