-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Throw if Redis does not use supported eviction policies #34178
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
[Cache] Throw if Redis does not use supported eviction policies #34178
Conversation
Makes sense. Does this make a request to the server? I suppose yes. Are we OK with this extra roundtrip? Why? :) |
yes indeed, just like the Redis Server version check we had for sPOP (but that was lazy)
I'm not sure if it is ok or not tbh. Two possible pros:
=> In last case we can move this logic to be on-demand on first action that needs to save tag changes. We can also change it to be warning logged instead then like was the case with sPOP. /cc @Toflar |
Which interface do they use? For other methods, none can throw, so a warning on |
They don't use it directly, they use eZ and we use PSRs where where can (and plan to continue doing so until someone standardizes Symfony Contracts within PSRs :P ). Anyway, this would be on save, as that is where we can opt to set expiry for tags
I guess main options are:
|
What does "strange" mean here? I mean I get the point and I do agree that setting an eviction policy makes sense but I'm not really sure this is a Redis specific issue, is it? |
@Toflar we are perhaps talking about different issues here, to list them all up:
I'm first and foremost trying to solve people ending up with 3. here, but also contemplating solving 2. in the comments as it seems theoretical possible if user uses So I'm not really talking about 1. which I think might be what you had in mind with the File system comparisons here right? |
Ooooh, I see!! That's indeed a tricky issue to solve. So the reason why I'm not talking about your specific implementation just yet is that I'm trying to find out the root cause of the issue and if we can maybe tackle it completely differently 😊 So before we talk about fixing this issue, do you mind claryfing why we even need the specific adapter in the first place? (I didn't deep-dive into the |
Because it makes a single roundtrip per read, while |
I see. What I'm saying is that apparently the requirement of a tag cache entry is that it doesn't evict at all or at least not before any of the related cache items did. |
This comment has been minimized.
This comment has been minimized.
Okay, I understand. But then the message is confusing to me. It kind of tells me to configure the eviction policy correctly whereas maybe I'm using a completely strange setup anyway. What's your use case?
-> Use the
-> Use the [...] Maybe some matrix that answers questions like "Okay, I do have memcached, Redis and a database but I'm running on a single host, which combination should I choose?". |
This comment has been minimized.
This comment has been minimized.
I'm sure it has its place! If we adjusted the |
This comment has been minimized.
This comment has been minimized.
Aaaah! Wow that took a while to click for me, sorry! I see...meh, okay then that warning seems to be the only way to go. Personally I would refuse to save then. Most people won't see the issue in the logs anyway. :(
I am, we should meet independent from that issue anyway :P |
This comment has been minimized.
This comment has been minimized.
7d5cee5
to
f39f1da
Compare
Replaced by #34403. |
…rerom) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Cache] Redis Tag Aware warn on wrong eviction policy | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | Deprecations? | no | Tickets | n.a. | License | MIT | Doc PR | n.a. Adds validation to make sure Redis has been setup with the supported eviction policy to avoid surprises when cache suddenly is inconsistent. This PR replaces #34178, and instead of checking in constructor and throwing it only checks on save, warns about this and refuses to save cache as suggested on the other PR. TODO: - [x] ~Adapt test setups for this to set correct eviction policy~ _It already uses default noeviction_ Commits ------- e77f6de [Cache] Redis Tag Aware warn on wrong eviction policy
Adds validation to make sure Redis has been setup with the supported eviction policy to avoid surprises when cache suddenly is inconsistent. This is done in similar way to check for Redis version in 4.3, but in this case I opted to throw in constructor instead of doing it on demand and log warning only.
WDYT @nicolas-grekas ?
TODO: