Skip to content

[Cache] Improve the docs about cache namespaces #20966

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

javiereguiluz
Copy link
Member

@javiereguiluz javiereguiluz commented May 15, 2025

After talking with @nicolas-grekas about this, I think we should improve the recent docs about cache namespaces with more details like invalidation, a bit more context about when to use this, etc.

@javiereguiluz javiereguiluz merged commit ec396c3 into symfony:7.3 May 16, 2025
3 checks passed
You can even combine cache namespaces with :ref:`cache tags <cache-using-cache-tags>`
for more advanced needs.

There is no built-in way to invalidate caches by namespace. Instead, the recommended
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this be achieved with $cache->withSubNamespace('ns')->clear()?

Copy link
Member

Choose a reason for hiding this comment

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

It depends on the implementation: some support this, others not (they might return false or clear the full pool depending on the implementation.)
Not all backends support clearing by prefix...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants