Cannot get caches to clear by using URIs #372
Replies: 6 comments 7 replies
|
Same here. We want to invalidate cache for a given URI by doing: |
|
@roberttolton Have you found a solution for this? Thanks! |
|
@lgrassini The way I've gotten around it, is to tag my caches like so: And then clear them like so: |
|
Sorry to bother @freekmurze but even to this day I cannot get cache-clearing by URLs to work. Is there a hidden gotcha? I'm using the default suffix, so either User ID or empty string, and have the following URL: This does not get cleared by any of these calls: |
|
Hi @roberttolton @freekmurze , I figure out what's happening with the cache-clearing by URLs. The value of the I tried using the Workaround:
Proposed Solutions:
|
|
I had this error and got a fix. When you login, it will generate your own user id, so when you clear the cache by url, it will only work for you. My way will not return a separate cache for each user, instead all users will share the same cache. (In the file BaseCacheProfile.php, in the function useCacheNameSuffix I return an empty string that is resolved.) |
Uh oh!
There was an error while loading. Please reload this page.
Hi, thanks for the work on this package.
I'm using it in a new Laravel project, but am having trouble getting caches to clear with using URIs.
Clearing caches with tags works fine, but I'd like to understand what I am doing wrong that means giving an array of URIs does not clear the caches for those responses.
My routes api.php:
Line used to clear caches that is expected to work:
But this does not clear the cache. I have also tried this which doesn't work either:
Any ideas what I'm doing wrong?
I've edited the
laravel-responsecachesource files with debugging calls toray()and looked at the output, but I cannot see where or what is going wrong. It's like the URIs I'm asking to clear just can't be found in the cache.Thanks for the help.
All reactions