/** * Puts data into the cache. * * @access public * @param string $id The cache id. * @param mixed $data The cache entry/data. * @param int $lifeTime The lifetime in number of seconds for this cache entry. * If zero (the default), the entry never expires (although it may be deleted from the cache * to make place for other entries). */ public function save($id, $data, $lifetime = null) { if (Config::get('system.cache.enabled')) { if ($lifetime === null) { $lifetime = static::getLifetime(); } static::$driver->save($id, $data, $lifetime); } }
/** * @covers Heystack\Core\State\Backends\DoctrineCache::__construct * @covers Heystack\Core\State\Backends\DoctrineCache::removeAll * @covers Heystack\Core\State\Backends\DoctrineCache::getKeys * @covers Heystack\Core\State\Backends\DoctrineCache::getByKey * @covers Heystack\Core\State\Backends\DoctrineCache::removeByKey * @covers Heystack\Core\State\Backends\DoctrineCache::key */ public function testCanRemoveAllWithExcludes() { $sid = session_id(); $cacheProviderMock = $this->getMockBuilder('Doctrine\\Common\\Cache\\CacheProvider')->setMethods(['fetch', 'delete'])->getMockForAbstractClass(); $cacheProviderMock->expects($this->once())->method('fetch')->with($sid . '_' . DoctrineCache::TRACKING_KEY)->will($this->returnValue(['test', 'test2'])); $cacheProviderMock->expects($this->at(1))->method('delete')->with($sid . '_test2'); $m = new DoctrineCache($cacheProviderMock); $m->removeAll(['test']); }
/** * Helper method to clear RememberMe cache */ public static function clearCache() { $this->driver->flushAll(); }