-
Notifications
You must be signed in to change notification settings - Fork 336
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
Duplicate cache look ups #596
Comments
If you want to help, could you create a repository with a minimal reproduction? I misread before. This is the way Bouncer is currently designed. We could probably add another layer of local cache on top the cross-request cache. Will look into it. |
Reproduction is easy. the user has role of |
I used xdebug to trace the duplicate and found it. it's here: bouncer/src/CachedClipboard.php Lines 196 to 202 in c1eb580
Perhaps caching result of $this->cache->get($key) could reduce duplicates.By reduce duplicates, I mean bouncer still looks up same key with different ending f and a that is decided based on $allowed parameter and getAbilities() is called twice with different $allowed parameter. but this one is OK.get cache:tag:silber-bouncer:key is used by laravel's cache tag and it's not bouncer's fault.
|
I'm using redis as cache driver and enabled cross-request caching:
Bouncer::cache();
I'm also using telescope to monitor everything. I noticed every time I use
$user->can('something')
Bouncer gets 4 keys from cache, two of them are duplicate. but this isn't the only duplicate. if I use$user->can('something')
three times Bouncer gets 8 more keys which is exactly same as first four.Here is the image of telescope showing duplicate cache look ups for using
$user->can('something')
three times:I'm planning to use a lot of
$user->can()
and it's not a good thing to haven * 4
look ups on redisIs there a way to also cache them for current request?
The text was updated successfully, but these errors were encountered: