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.
Inheritance: use trait Webiny\Component\StdLib\ComponentTrait
コード例 #1
0
ファイル: Memcache.php プロジェクト: Webiny/Framework
 /**
  * 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);
 }
コード例 #2
0
ファイル: CacheTest.php プロジェクト: Webiny/Framework
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml');
     Cache::setConfig(__DIR__ . '/../Mocks/MockCacheConfig.yaml');
     Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml');
 }
コード例 #3
0
ファイル: CacheTraitTest.php プロジェクト: Webiny/Framework
 public function setUp()
 {
     Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
 }
コード例 #4
0
ファイル: RouterTest.php プロジェクト: Nkelliny/Framework
 public function testSetGetCacheAsCacheObject()
 {
     $nullCache = Cache::Null();
     Router::getInstance()->setCache($nullCache);
     $this->assertInstanceOf('\\Webiny\\Component\\Cache\\CacheStorage', Router::getInstance()->getCache());
 }
コード例 #5
0
ファイル: CacheTest.php プロジェクト: Webiny/Framework
 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));
 }
コード例 #6
0
 public function testRegisterCacheDriver()
 {
     ClassLoader::getInstance()->registerCacheDriver(Cache::Null());
     $autoloaders = spl_autoload_functions();
     $this->assertSame('getClassFromCache', $autoloaders[0][1]);
 }
コード例 #7
0
 public function driverSet()
 {
     Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
     return [[Cache::Memcache(self::MEMCACHE_IP)]];
 }
コード例 #8
0
ファイル: CacheStorageTest.php プロジェクト: Webiny/Framework
 public function setUp()
 {
     Cache::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
     $this->instance = Cache::SessionArray();
 }