The cache component is used to store different information into memory or file system for much faster access.
The stored information can only be accessed for a limited time, after which it is invalidated.
The Memory library is required by this class.
/** * Get the name of bridge library which will be used as the driver. * * @return string */ public static function getLibrary() { return Cache::getConfig()->get('Bridges.Memcache', self::$library); }
public function setUp() { Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml'); Cache::setConfig(__DIR__ . '/../Mocks/MockCacheConfig.yaml'); Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml'); }
public function setUp() { Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG)); }
public function testSetGetCacheAsCacheObject() { $nullCache = Cache::Null(); Router::getInstance()->setCache($nullCache); $this->assertInstanceOf('\\Webiny\\Component\\Cache\\CacheStorage', Router::getInstance()->getCache()); }
public function testConfigServices() { $this->assertSame('\\Webiny\\Component\\Cache\\Cache', Cache::getConfig()->get('Services.TestCache.Factory')); $this->assertSame('\\Webiny\\Component\\Cache\\Bridge\\Memory\\Memcache', Cache::getConfig()->get('Bridges.Memcache')); $this->assertFalse(Cache::getConfig()->get('Bridges.FakeBridge', false)); }
public function testRegisterCacheDriver() { ClassLoader::getInstance()->registerCacheDriver(Cache::Null()); $autoloaders = spl_autoload_functions(); $this->assertSame('getClassFromCache', $autoloaders[0][1]); }
public function driverSet() { Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG)); return [[Cache::Memcache(self::MEMCACHE_IP)]]; }
public function setUp() { Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG)); $this->instance = Cache::SessionArray(); }