/** * @return ProxyStrategyResponse */ public function postExecute(ProxyStrategyRequest $proxyStrategyRequest) { /** @var CacheProxyStrategyRequest $proxyStrategyRequest */ $saved = $this->cache->saveWithNamespace($proxyStrategyRequest->getId(), $proxyStrategyRequest->getData(), $proxyStrategyRequest->getNamespaceId(), $proxyStrategyRequest->getLifeTime()); $response = new ProxyStrategyResponseDTO($saved, false); return $response; }
/** * @return Cache */ public function build() { if (null === $this->cache) { $this->cache = new CacheImpl(new ArrayCache()); } if (null !== $this->defaultLifetime) { $this->cache->setDefaultLifetime($this->defaultLifetime); } return $this->cache; }
/** * @test */ public function Invalidate_ReturnTrue() { $this->cacheProviderSpy->cacheProvider->save(self::NAMESPACE_ID, self::NAMESPACE_ID_VALUE); $this->cacheProviderSpy->cacheProvider->save(self::NAMESPACE_ID_VALUE . self::ID, self::NAMESPACE_DATA); $invalidated = $this->cache->invalidate(self::NAMESPACE_ID); $this->assertTrue($invalidated); $this->assertTrue($this->cacheProviderSpy->saveHasBeenCalled); $this->assertEquals(CacheProviderSpy::NAMESPACE_ID, $this->cacheProviderSpy->id); }