src/AppBundle/Helper/HelperBase.php 1 location
|
@@ 50-59 (lines=10) @@
|
| 47 |
|
* @param string $key The cache key. |
| 48 |
|
* @return mixed|null Whatever's in the cache, or null if the key isn't present. |
| 49 |
|
*/ |
| 50 |
|
protected function cacheGet($key) |
| 51 |
|
{ |
| 52 |
|
/** @var \Symfony\Component\Cache\Adapter\AdapterInterface $cache */ |
| 53 |
|
$cache = $this->container->get('cache.app'); |
| 54 |
|
$item = $cache->getItem($this->getCacheKey($key)); |
| 55 |
|
if ($item->isHit()) { |
| 56 |
|
return $item->get(); |
| 57 |
|
} |
| 58 |
|
return null; |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/** |
| 62 |
|
* Save a value to the cache. |
src/Xtools/EditSummary.php 1 location
|
@@ 257-269 (lines=13) @@
|
| 254 |
|
* @return bool Whether data was successfully pulled from the cache. |
| 255 |
|
* @codeCoverageIgnore |
| 256 |
|
*/ |
| 257 |
|
private function loadFromCache() |
| 258 |
|
{ |
| 259 |
|
$cacheKey = $this->getCacheKey(); |
| 260 |
|
|
| 261 |
|
$cache = $this->container->get('cache.app'); |
| 262 |
|
|
| 263 |
|
if ($cache->hasItem($cacheKey)) { |
| 264 |
|
$this->data = $cache->getItem($cacheKey)->get(); |
| 265 |
|
return true; |
| 266 |
|
} |
| 267 |
|
|
| 268 |
|
return false; |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
/** |
| 272 |
|
* Build cache key using helper in Repository. |