Skip to content

[Cache] Fix redis adapter config to work with tags #19996

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
Aug 6, 2024

Conversation

Huluti
Copy link
Contributor

@Huluti Huluti commented Jun 26, 2024

I found that to work with redis and tags using this config was not working (tag not set and invalidation not working):

 'adapter' => 'cache.adapter.redis',
 'tags' => true,

While with this one all was working fine:

adapter' => 'cache.adapter.redis_tag_aware',

Up to you if you think that it makes sense :)

Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

looks good to me

@xabbuh
Copy link
Member

xabbuh commented Jul 19, 2024

@nicolas-grekas This applies to 5.4 too, right?

@javiereguiluz
Copy link
Member

@xabbuh you are right. This is available since 5.2: symfony/symfony#36596

@javiereguiluz javiereguiluz added this to the 5.4 milestone Aug 5, 2024
@carsonbot carsonbot changed the title Fix redis adapter config to work with tags [Cache] Fix redis adapter config to work with tags Aug 5, 2024
@xabbuh xabbuh changed the base branch from 7.1 to 5.4 August 6, 2024 08:15
@xabbuh xabbuh requested a review from OskarStark as a code owner August 6, 2024 08:15
@xabbuh
Copy link
Member

xabbuh commented Aug 6, 2024

Thank you @Huluti.

@xabbuh xabbuh merged commit 8fe145a into symfony:5.4 Aug 6, 2024
3 checks passed
@Huluti Huluti deleted the patch-1 branch August 6, 2024 08:16
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Aug 12, 2024

I'm sorry but this change looks wrong to me. I just created a small app and the previous snippet works well.
tags: true works with all adapters, while cache.adapter.redis_tag_aware is specific to redis.
(note that for redis, those two configs lead to different cache storage strategies, see docblock on top of each implementation if the doc isn't clear on this aspect)

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Aug 12, 2024

@Huluti did you use TagAwareCacheInterface or CacheInterface when experiencing the issue? Only the former works.

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.

5 participants