public function createCachePool() { // we need this, as memory storage goes way when the instances looses scope if (null === $this->memoryCache) { $this->memoryCache = CacheFactory::make(CacheFactory::MEMORY); } return $this->memoryCache; }
public function testTwoLevelCacheSaveAndFetch() { $memory1 = CacheFactory::make(CacheFactory::MEMORY); $memory2 = CacheFactory::make(CacheFactory::MEMORY); $cache = CacheFactory::make(CacheFactory::TWO_LEVEL, $memory1, $memory2); $item = $cache->getItem('key')->set('value'); $cache->save($item); // assert that both caches have the item $this->assertTrue($memory1->getItem('key')->isHit()); $this->assertTrue($memory2->getItem('key')->isHit()); // hack and delete on first cache $memory1->clear(); $this->assertTrue($cache->getItem('key')->isHit()); }
public function createCachePool() { return CacheFactory::make(CacheFactory::FILE); }
public function testFileCacgeFactory() { $cache = CacheFactory::make(CacheFactory::FILE); $this->assertInstanceOf('Psr\\Cache\\CacheItemPoolInterface', $cache); }
private function getSecondLevelCache() { $redisClient = new Redis(); $redisClient->connect('127.0.0.1'); return CacheFactory::make(CacheFactory::REDIS, $redisClient); }
public function createCachePool() { $redisClient = new Redis(); $redisClient->connect('127.0.0.1'); return CacheFactory::make(CacheFactory::REDIS, $redisClient); }
public function createCachePool() { $memcached = new Memcached('cant'); $memcached->addServer('localhost', 11211); return CacheFactory::make(CacheFactory::MEMCACHED, $memcached); }