Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 public function warm(AbstractService $service, AbstractService $cachedService)
 {
     if (!$service instanceof ServiceCacheableInterface) {
         return;
     }
     $service->setNoCache(true);
     $service->getClient()->setOptions($cachedService->getClient()->getOptions());
     $service->sendRequest($cachedService->getRequest());
 }
Esempio n. 2
0
 /**
  * @param AbstractService $service
  *
  * @return bool
  */
 private function isEligibile(AbstractService $service)
 {
     return $service instanceof ServiceCacheableInterface && null !== $service->getCacheAdapter() && $service->canBeWarmed() && $service->isObsolete();
 }
Esempio n. 3
0
 /**
  * @param AbstractService $service
  *
  * @return CacheableInterface|null
  */
 protected function createCache(AbstractService $service)
 {
     if (!$service instanceof ServiceCacheableInterface) {
         return null;
     }
     return new CacheableData($service->getHashKey(), $service->getTtl(), $service);
 }