Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 315 forks source link

Help! how to use redis-py-cluster to realize string fuzzy matching or fuzzy deleting? #405

Closed fensirs closed 4 years ago

fensirs commented 4 years ago

XXX.XX.58.40:6384> get test1 -> Redirected to slot [4768] located at XXX.XX.58.38:6380 "1" XXX.XX.58.38:6380> get test2 -> Redirected to slot [8899] located at XXX.XX.58.38:6381 "2" XXX.XX.58.38:6381> get test3 -> Redirected to slot [13026] located at XXX.XX.58.40:6384 "3" XXX.XX.58.40:6384> get test4 -> Redirected to slot [517] located at XXX.XX.58.38:6380 "4" XXX.XX.58.38:6380> get test5 "5"

i have a cluster of redis, i want to batch delete the string matching test *, can i use redis-py-cluster realize this function?

Grokzen commented 4 years ago

Normally i would not answer this as this is not an issue for the project but a question that should be asked on StackOverflow instead. But i will make an exception... So use KEYS with glob pattern and enumerate your keys you want to delete and then use the delete function to remove them.