Using new remember() helper

parent 89508b4a
......@@ -33,15 +33,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function findByName($settingName)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.findByName.{$settingName}",
$this->cacheTime,
function () use ($settingName) {
return $this->remember(function () use ($settingName) {
return $this->repository->findByName($settingName);
}
);
});
}
/**
......@@ -52,17 +46,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function moduleSettings($modules)
{
$moduleList = implode(',', $modules);
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}",
$this->cacheTime,
function () use ($modules) {
return $this->remember(function() use ($modules) {
return $this->repository->moduleSettings($modules);
}
);
});
}
/**
......@@ -72,15 +58,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function savedModuleSettings($module)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->remember(function() use ($module) {
return $this->repository->savedModuleSettings($module);
}
);
});
}
/**
......@@ -90,15 +70,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function findByModule($module)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.findByModule.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->remember(function() use ($module) {
return $this->repository->findByModule($module);
}
);
});
}
/**
......@@ -108,15 +82,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function get($settingName)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.get.{$settingName}",
$this->cacheTime,
function () use ($settingName) {
return $this->remember(function() use ($settingName) {
return $this->repository->get($settingName);
}
);
});
}
/**
......@@ -126,15 +94,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function translatableModuleSettings($module)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->remember(function() use ($module) {
return $this->repository->translatableModuleSettings($module);
}
);
});
}
/**
......@@ -144,14 +106,8 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
*/
public function plainModuleSettings($module)
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember(
"{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->remember(function() use ($module) {
return $this->repository->plainModuleSettings($module);
}
);
});
}
}
......@@ -3,6 +3,7 @@ versions:
"3.4.0@unreleased":
changed:
- Fix settings with falsey values not getting returned
- Using new <code>remember</code> method in the <code>CacheSettingDecorator</code> class
"3.1.0":
changed:
- Checking for null value instead of empty for non translatable settings
......
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