page-cache
page-cache copied to clipboard
Document suggestion for cache invalidation
Since the PHP stack is out of reach, I don't see how cache invalidation works. For example, to renew the generated start page of a content driven site every 10 minutes. Please provide a suggestion how to handle that.
Thanks in advance.
I don't see that either, but you could schedule the artisan command for the specific slug.
One could also use this to create an observer that clears the specific cache entry when saving a model. I have not used his package for now, but the availability of this command suggests that there also is a call that can be made without using the scheduling functionality. It would be nice if that would be documented, though.
I added the something like this to an observer, and it works:
$cache = app()->make(Cache::class);
$cache->clear($slug);
$cache->forget($slug);
I was thinking about how to do this as well. However, in my case we have more than 1 web server in a serverless context, so cache invalidation needs to be propagated across all of them.