Redis Python - how to delete all keys according to a specific pattern In python, without python iterating

后端 未结 9 636
暗喜
暗喜 2020-12-25 10:42

I\'m writing a django management command to handle some of our redis caching. Basically, I need to choose all keys, that confirm to a certain pattern (for example: \"prefix:

9条回答
  •  旧时难觅i
    2020-12-25 11:20

    Btw, for the django-redis you can use the following (from https://niwinz.github.io/django-redis/latest/):

    from django.core.cache import cache
    cache.delete_pattern("foo_*")
    

提交回复
热议问题