Flintstone\Config::setCache PHP Method

setCache() public method

Set the cache.
public setCache ( mixed $cache )
$cache mixed
    public function setCache($cache)
    {
        if (!is_bool($cache) && !$cache instanceof CacheInterface) {
            throw new Exception('Cache must be a boolean or an instance of Flintstone\\Cache\\CacheInterface');
        }
        if ($cache === true) {
            $cache = new ArrayCache();
        }
        $this->config['cache'] = $cache;
    }

Usage Example

Example #1
0
 /**
  * @expectedException Flintstone\Exception
  */
 public function testConfigInvalidCache()
 {
     $config = new Config();
     $config->setCache(new self());
 }