Pinq\Caching\CacheProvider::setCustomCache PHP Method

setCustomCache() public static method

Uses the supplied cache to store the parsed queries.
public static setCustomCache ( Pinq\Caching\ICacheAdapter $cache ) : void
$cache Pinq\Caching\ICacheAdapter The cache implementations
return void
    public static function setCustomCache(ICacheAdapter $cache)
    {
        self::$cacheImplementation = $cache;
        self::$hasBeenCleared = false;
    }

Usage Example

Exemplo n.º 1
0
 public function testThatDevelopmentModeWillClearTheCacheOnce()
 {
     $functionCacheMock = $this->getMock('Pinq\\Caching\\ICacheAdapter');
     $functionCacheMock->expects($this->once())->method('clear');
     Caching\CacheProvider::setCustomCache($functionCacheMock);
     Caching\CacheProvider::setDevelopmentMode(true);
     //Should clear
     Caching\CacheProvider::getCache();
     //Should not clear again
     Caching\CacheProvider::getCache();
 }