/** * {@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()); }
/** * @param AbstractService $service * * @return bool */ private function isEligibile(AbstractService $service) { return $service instanceof ServiceCacheableInterface && null !== $service->getCacheAdapter() && $service->canBeWarmed() && $service->isObsolete(); }
/** * @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); }