entrust: This cache store does not support tagging.
Happend after update to 5.2.
Not sure if this has something to do with entrust but in the list I see that this issue has something to do with Repository->tags(‘role_user’) and Cache::tags(‘role_user’) in EntrustUserTrait.php line 29
BadMethodCallException in C:\wamp\www\baseapp\vendor\laravel\framework\src\Illuminate\Cache\Repository.php line 380:
This cache store does not support tagging.
in Repository.php line 380
at Repository->tags('role_user')
at call_user_func_array(array(object(Repository), 'tags'), array('role_user')) in CacheManager.php line 296
at CacheManager->__call('tags', array('role_user')) in Facade.php line 216
at CacheManager->tags('role_user') in Facade.php line 216
at Facade::__callStatic('tags', array('role_user')) in EntrustUserTrait.php line 29
at Cache::tags('role_user') in EntrustUserTrait.php line 29
at User->save() in EloquentUserProvider.php line 78
Anyone else had this one? And ideas?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 46
- Comments: 75 (2 by maintainers)
Commits related to this issue
- User can create and edit sponsors Summary: * Link in user nav dropdown for "Edit Sponsors" * List of sponsors that user owns * User can create a new sponsor * User can edit existing sponsor that they... — committed to opengovfoundation/madison by sethetter 7 years ago
- updated git ignore to not to ignore .env, updated .env, set CACHE_DRIVER = memcached and this is due to this issue: https://github.com/Zizaco/entrust/issues/679 and https://github.com/Zizaco/entrust/i... — committed to uscbsitric/StartingPoint by uscbsitric 7 years ago
Yes, Laravel file and database drivers doesn’t support tags. What you can do to while developing is change the driver to array in your .env file.
CACHE_DRIVER=array
in your .env file change to cache array
CACHE_DRIVER=array
and dont forget to run
php artisan config:cache
WARNING: is not a permanent solution, just disables caching. So while Cache methods will work, no data will actually be available between requests. You better configure memcached or redis ( thanks @CaptainHypertext )
I changed to composer to “zizaco/entrust”: “dev-laravel-5” and it solved it.
Blade directives
working but
not.
should i change both settings? .env file
and in config/cache.php
I have tried for all still i am getting error regarding cache
BadMethodCallException in Repository.php line 367: This cache store does not support tagging.
“zizaco/entrust”: “dev-laravel-5” will solve this problem
Just change: “zizaco/entrust”: “5.2.x-dev” TO “zizaco/entrust”: “dev-master”
then solved.
“dev-master” have Merged pjmartorell:fix-cache-tags
Changing cache driver to array:
CACHE_DRIVER=array
fixed this issue for me, I am also creating user and attaching role directly after and have no issue. I’m using laravel 5.2.It is possible to use apc, memcached or redis.
Moreover, they are all preconfigured in
homestead
environment.I am still the same error, even after update .env file and change to composer to “zizaco/entrust”: “dev-laravel-5” 😦
@thanhdevapp You can either fork it or use it temporary until changes/PR are merged into this package.
Add this to your composer.json
@pjmartorell: Thanks for providing your solution! Yes, the exceptions are fixed, but a cache for non-taggable providers is still missing.
Right now, when using
array
orfile
caches, Entrust will query the DB every time a permission/role is requested—even though it’s exactly the same query. To avoid that, I extended your code a bit, so that they are at least cached for the request.Using array as a cache driver works, but it’s an workaround and should not be used in production. Any other solution to don’t use array as a cache driver? thanks in advance.
@marcoraddatz @thanhdevapp @kickthemooon All these errors/alerts are fixed in branch
master
. Do a require of"zizaco/entrust": "dev-master"
to install it. You can check the changes done to solve it in https://github.com/Zizaco/entrust/pull/547.This cache feature I guess is perfect for big/performant systems.
But for something quick I just switched to https://github.com/caffeinated/shinobi
Because is quicker to configure and already has a GUI and I’m lazy.
+2
I think I found the issue, maybe.
and here is the entrust trait:
Could this be the issue and how can it be dealt with?
See #422 for a fix that doesnt involve changing the cache driver. It tells you to use the following version “dev-laravel-5” in your composer.json
I’m having issues with this in 5.2 when I moved to production. Is there a solution for production?
**EDIT: Nevermind. The documentation states that tagging does not work with file or database cache. I changed to memcached and it worked fine.**
Switching to array is not a solution if you use the DB for a cache in production.
I changed to composer.json to “zizaco/entrust”: “dev-laravel-5” as well as updated my .env file and config/cache.php file to be CACHE_DRIVER array. Problem was solved for me
.env CACHE_DRIVER=array is worked for me
CACHE_DRIVER=array
is just a temporary fix for development, isn’t it? I’d like to keep using the file cache driver on the production site but that isn’t working right now. Any news on this issue?Occured to me when registering a new user on a new L5.2 installation with
"zizaco/entrust": "5.2.x-dev",
I have
CACHE_DRIVER=array
and works fine !!! However I want to useCACHE_DRIVER=memcached
. I’ve tried to add on the .env file the memcached but it doesn’t work. Keep sayingClass 'Memcached' not found
. I’ve tried to download memcached but I dont have apt-get in my shared server. What can I do ? Anyone can help me ?Try to config cache ( php artisan config:cache ) for laravel
CACHE_DRIVER=array work for me on v5.3.24 remember to restart your web server.
@marcoraddatz Nice, but if there is a
file
store defined, with your implementation, you are forcing the user to use an ‘array’ store.@eduardoarandah, @CaptainHypertext: As far as I know doesn’t
array
disable the cache, but restricts it to a single request only.I just forked the project and played around a bit. Following code reduced my queries dramatically (40+ queries to 8):
and
Full code is at https://github.com/marcoraddatz/entrust – will provide it soon via packagist.
Ultimately I made the decision that the best option was to start using memcached.
I m facing problem while i am registering new user and setting role for that user in controller