Using the remember helper

parent 3ae3bd92
......@@ -29,15 +29,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
*/
public function findHomepage()
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.findHomepage",
$this->cacheTime,
function () {
return $this->repository->findHomepage();
}
);
return $this->remember(function () {
return $this->repository->findHomepage();
});
}
/**
......@@ -46,15 +40,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
*/
public function countAll()
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.countAll",
$this->cacheTime,
function () {
return $this->repository->countAll();
}
);
return $this->remember(function () {
return $this->repository->countAll();
});
}
/**
......@@ -64,15 +52,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
*/
public function findBySlugInLocale($slug, $locale)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.findBySlugInLocale.{$slug}.{$locale}",
$this->cacheTime,
function () use ($slug, $locale) {
return $this->repository->findBySlugInLocale($slug, $locale);
}
);
return $this->remember(function () use($slug, $locale) {
return $this->repository->findBySlugInLocale($slug, $locale);
});
}
/**
......
......@@ -3,6 +3,8 @@ versions:
"3.4.0@unreleased":
changed:
- Fixed vuejs compatibility
- Using new <code>remember</code> method in the <code>CachePageDecorator</code> class
- Fixing bug where the current page was not cached as well on the server side pagination
"3.2.0":
added:
- Adding the page status field
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment