Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont use cache.ttl, but use entrust.cache_ttl instead #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Entrust/Traits/EntrustRoleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function cachedPermissions()
$rolePrimaryKey = $this->primaryKey;
$cacheKey = 'entrust_permissions_for_role_'.$this->$rolePrimaryKey;
if(Cache::getStore() instanceof TaggableStore) {
return Cache::tags(Config::get('entrust.permission_role_table'))->remember($cacheKey, Config::get('cache.ttl', 60), function () {
return Cache::tags(Config::get('entrust.permission_role_table'))->remember($cacheKey, Config::get('entrust.cache_ttl', 60), function () {
return $this->perms()->get();
});
}
Expand Down
14 changes: 14 additions & 0 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,19 @@
*/
'role_user_table' => 'role_user',

/*
|--------------------------------------------------------------------------
| Entrust permissions cache TTL
|--------------------------------------------------------------------------
|
|
| If cache_ttl is a positive integer,
| Entrust will cache permissions in a configured cache storage.
|
| cache_ttl should be set in minutes and by default equals to null,
| which mean no caching
|
*/
'cache_ttl' => null,

];