You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
topic1:*` can have X elements
topic2:*` can have Y elements
The full names of the keys would be in the format topic:operation_id, such as:
topic1:001
topic2:005
topic3:002
...
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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