/** * @return ICacheAdapter */ private static function getImplementation() { if (self::$cacheImplementation === null) { self::$cacheImplementation = new NullCache(); } if (self::$isDevelopmentMode && !self::$hasBeenCleared) { self::$cacheImplementation->clear(); self::$hasBeenCleared = true; } return self::$cacheImplementation; }
public function testThatNamespaceWillNotClearInAnotherNamespaces() { $anotherNamespaceCache = $this->namespacedCache->forNamespace('another::namespace'); $anotherNamespaceCache->save('in-another-namespace-1', 1); $anotherNamespaceCache->save('in-another-namespace-2', 2); $this->namespacedCache->save('in-namespace', 2); $this->namespacedCache->clear(); $this->assertFalse($this->namespacedCache->contains('in-namespace')); $this->assertTrue($anotherNamespaceCache->contains('in-another-namespace-1')); $this->assertTrue($anotherNamespaceCache->contains('in-another-namespace-2')); }
public function clear() { self::$secondLevelCache = []; $this->cacheAdapter->clear(); }