Limit Redis KeySpace based on Prefix #13151
Unanswered
dynamic-entropy
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What strategies can I use to limit the number of keys based on a prefix?
For example, I would like to impose a limit on the key-space prefix as follows:
The full names of the keys would be in the format
topic:operation_id
, such as:My use case is as follows:
I have multiple clients writing to the same Redis instance under multiple key-prefixes (from hereon referred to as topics). It is a many-to-many relationship between a client and the topic it is writing to.
These clients would regularly clean up these topics when the work is done for the
topic:id
and put them onto a queue.(There is an additional requirement that the LIST size be limited, but I believe I can handle this programmatically with
LLEN
.)However, it can happen that there is an issue with cleaning up the upstream queue. Because of this, we should deny more entries being added to the topic.
The intention behind this is to not disrupt other topics when there are issues cleaning a single topic, which might fill the memory if left unchecked.
Apologies for any vagueness. I am happy to clarify.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions