Skip to content
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

[5.x] Allow custom asset container contents cache store #11481

Conversation

ryanmitchell
Copy link
Contributor

Currently the asset container contents are generated and cached in the default cache store, which means if you clear the application cache it needs to rebuilt. When you are using a driver such as S3 this can be quite slow and resource intensive.

This PR provides the option to specify a asset_container_contents cache store, similar to the approach used in #9405

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks.

In the other PR you referenced, it uses a try catch to get the store. Any reason why you went a different way here?

@ryanmitchell
Copy link
Contributor Author

It did initially - but it seems to have been changed since , so I followed the current approach:

public function cacheStore()
{
return Cache::store($this->hasCustomStore() ? 'static_cache' : null);
}
private function hasCustomStore(): bool
{
return config()->has('cache.stores.static_cache');
}

@jasonvarga jasonvarga dismissed their stale review February 21, 2025 14:53

I should have never doubted Ryan

@jasonvarga jasonvarga merged commit 9054201 into statamic:5.x Feb 21, 2025
18 checks passed
@ryanmitchell ryanmitchell deleted the feature/allow-custom-asset-container-cache-store branch February 21, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants