Get list of Cache Keys in Django

前端 未结 8 1956
暗喜
暗喜 2020-12-15 17:28

I\'m trying to understand how Django is setting keys for my views. I\'m wondering if there\'s a way to just get all the saved keys from Memcached. something like a cac

相关标签:
8条回答
  • 2020-12-15 17:56

    The Memcached documentation recommends that instead of listing all the cache keys, you run memcached in verbose mode and see everything that gets changed. You should start memcached like this

    memcached -vv
    

    and then it will print the keys as they get created/updated/deleted.

    0 讨论(0)
  • 2020-12-15 17:58

    For RedisCache you can get all available keys with.

    from django.core.cache import cache
    
    cache.keys('*')
    
    0 讨论(0)
提交回复
热议问题