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
0db1b089
Unverified
Commit
0db1b089
authored
Nov 20, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using the remember helper
parent
3ae3bd92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
27 deletions
+11
-27
CachePageDecorator.php
Modules/Page/Repositories/Cache/CachePageDecorator.php
+9
-27
changelog.yml
Modules/Page/changelog.yml
+2
-0
No files found.
Modules/Page/Repositories/Cache/CachePageDecorator.php
View file @
0db1b089
...
...
@@ -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
);
});
}
/**
...
...
Modules/Page/changelog.yml
View file @
0db1b089
...
...
@@ -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
...
...
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