set a default and max ttl for redis keys#38562
Merged
Conversation
a60dee9 to
d50a43b
Compare
blizzz
approved these changes
May 31, 2023
Member
blizzz
left a comment
There was a problem hiding this comment.
Should be mentioned in developer documentation as well.
Member
|
|
Member
|
I think it would be reasonable to also define an upper bound for TTL. Like a cache key can only exist for three months. |
Member
|
Could this applied as a patch in 24.0.7? |
d50a43b to
5b4f615
Compare
Member
Author
|
Switched the default to 1 day as per the interface docs and added a max of 1 month |
5b4f615 to
b27b5ed
Compare
come-nc
reviewed
Jun 19, 2023
| return $this->getCache()->setex($this->getPrefix() . $key, $ttl, $value); | ||
| } else { | ||
| return $this->getCache()->set($this->getPrefix() . $key, $value); | ||
| if ($ttl === 0) { |
Contributor
There was a problem hiding this comment.
I’m a tiny bit worried that we may have code path not sending an int in $ttl since it is not strong typed, so here passing '0' would still result in infinite TTL I think?
Not sure if this worry is justified.
Member
There was a problem hiding this comment.
We were already checking for an int, I'd say LGTM
Merged
skjnldsv
approved these changes
Feb 23, 2024
having infinite TTL can lead to leaked keys as the prefix changes with version upgrades Signed-off-by: Robin Appelman <robin@icewind.nl>
b27b5ed to
cc3c7c2
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
having infinite TTL can lead to leaked keys as the prefix changes with version upgrades