-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
[4.x] Allow a custom static caching url store to be specified #9405
[4.x] Allow a custom static caching url store to be specified #9405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than setting a path and making an explicit FileStore
, I think it could be better to let you create a static_cache
cache store, and use that if it exists. Like we do for the outpost:
Lines 183 to 196 in a0efa08
private function cache() | |
{ | |
if ($this->store) { | |
return $this->store; | |
} | |
try { | |
$store = Cache::store('outpost'); | |
} catch (InvalidArgumentException $e) { | |
$store = Cache::store(); | |
} | |
return $this->store = $store; | |
} |
Would that not be the same and remove everything during cache:clear ? |
Nope. Only the default store is cleared during |
Ah cool. Didn’t know that. Thanks! |
I've updated that now. Would it make sense for me to PR a change to https://github.com/statamic/statamic/blob/4.x/config/cache.php to include a static_cache store so that the default behaviour is updated? |
Yes. Make sure that the |
Static caching stores a cache of mapping of URLs to filenames in the Laravel cache, which is retrieved during invalidation.
However, if you have cleared your Laravel cache (eg artisan cache:clear), this mapping is lost, so no URLs are invalidated.
This PR provides a work around this behaviour by allowing a
static_cache
cache store to specified, which is then used for storing these urls. This wont be affected by the default cache:clear command, only byphp artisan static:clear
Closes #7333