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
a047aef0
Unverified
Commit
a047aef0
authored
Nov 20, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using new remember() helper for menu repositories
parent
fee36dc2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
63 deletions
+25
-63
CacheMenuDecorator.php
Modules/Menu/Repositories/Cache/CacheMenuDecorator.php
+3
-9
CacheMenuItemDecorator.php
Modules/Menu/Repositories/Cache/CacheMenuItemDecorator.php
+18
-54
changelog.yml
Modules/Menu/changelog.yml
+4
-0
No files found.
Modules/Menu/Repositories/Cache/CacheMenuDecorator.php
View file @
a047aef0
...
...
@@ -25,14 +25,8 @@ class CacheMenuDecorator extends BaseCacheDecorator implements MenuRepository
*/
public
function
allOnline
()
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.allOnline"
,
$this
->
cacheTime
,
function
()
{
return
$this
->
repository
->
allOnline
();
}
);
return
$this
->
remember
(
function
()
{
return
$this
->
repository
->
allOnline
();
});
}
}
Modules/Menu/Repositories/Cache/CacheMenuItemDecorator.php
View file @
a047aef0
...
...
@@ -27,15 +27,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
rootsForMenu
(
$menuId
)
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.rootsForMenu.
{
$menuId
}
"
,
$this
->
cacheTime
,
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
rootsForMenu
(
$menuId
);
}
);
return
$this
->
remember
(
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
rootsForMenu
(
$menuId
);
});
}
/**
...
...
@@ -45,15 +39,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
getForRoutes
()
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.getForRoutes"
,
$this
->
cacheTime
,
function
()
{
return
$this
->
repository
->
getForRoutes
();
}
);
return
$this
->
remember
(
function
()
{
return
$this
->
repository
->
getForRoutes
();
});
}
/**
...
...
@@ -64,15 +52,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
getRootForMenu
(
$menuId
)
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.getRootForMenu.
{
$menuId
}
"
,
$this
->
cacheTime
,
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
getRootForMenu
(
$menuId
);
}
);
return
$this
->
remember
(
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
getRootForMenu
(
$menuId
);
});
}
/**
...
...
@@ -83,15 +65,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
getTreeForMenu
(
$menuId
)
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.getTreeForMenu.
{
$menuId
}
"
,
$this
->
cacheTime
,
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
getTreeForMenu
(
$menuId
);
}
);
return
$this
->
remember
(
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
getTreeForMenu
(
$menuId
);
});
}
/**
...
...
@@ -102,15 +78,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
allRootsForMenu
(
$menuId
)
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.allRootsForMenu.
{
$menuId
}
"
,
$this
->
cacheTime
,
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
allRootsForMenu
(
$menuId
);
}
);
return
$this
->
remember
(
function
()
use
(
$menuId
)
{
return
$this
->
repository
->
allRootsForMenu
(
$menuId
);
});
}
/**
...
...
@@ -120,14 +90,8 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
*/
public
function
findByUriInLanguage
(
$uri
,
$locale
)
{
return
$this
->
cache
->
tags
([
$this
->
entityName
,
'global'
])
->
remember
(
"
{
$this
->
locale
}
.
{
$this
->
entityName
}
.findByUriInLanguage.
{
$uri
}
.
{
$locale
}
"
,
$this
->
cacheTime
,
function
()
use
(
$uri
,
$locale
)
{
return
$this
->
repository
->
findByUriInLanguage
(
$uri
,
$locale
);
}
);
return
$this
->
remember
(
function
()
use
(
$uri
,
$locale
)
{
return
$this
->
repository
->
findByUriInLanguage
(
$uri
,
$locale
);
});
}
}
Modules/Menu/changelog.yml
View file @
a047aef0
url
:
https://github.com/AsgardCms/Platform
versions
:
"
3.4.0@unreleased"
:
changed
:
-
Using new <code>remember</code> method in the <code>CacheMenuDecorator</code> class
-
Using new <code>remember</code> method in the <code>CacheMenuItemDecorator</code> class
"
3.2.0"
:
changed
:
-
Use blade directive in Menu module views
...
...
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