Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
fee36dc2
Unverified
Commit
fee36dc2
authored
Nov 20, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using new remember() helper
parent
89508b4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
65 deletions
+22
-65
CacheSettingDecorator.php
Modules/Setting/Repositories/Cache/CacheSettingDecorator.php
+21
-65
changelog.yml
Modules/Setting/changelog.yml
+1
-0
No files found.
Modules/Setting/Repositories/Cache/CacheSettingDecorator.php
View file @
fee36dc2
...
...
@@ -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
->
repository
->
findByName
(
$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
->
repository
->
moduleSettings
(
$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
->
repository
->
savedModuleSettings
(
$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
->
repository
->
findByModule
(
$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
->
repository
->
get
(
$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
->
repository
->
translatableModuleSettings
(
$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
->
repository
->
plainModuleSettings
(
$module
);
}
);
return
$this
->
remember
(
function
()
use
(
$module
)
{
return
$this
->
repository
->
plainModuleSettings
(
$module
);
});
}
}
Modules/Setting/changelog.yml
View file @
fee36dc2
...
...
@@ -3,6 +3,7 @@ versions:
"
3.4.0@unreleased"
:
changed
:
-
Fix settings with
false
y 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment