获取Django中的Cache Keys列表 [英] Get list of Cache Keys in Django
问题描述
我正在尝试了解Django如何为我的观点设置键。我想知道是否有办法从Memcached中获取所有保存的密钥。像$ cache.all()
等等。我一直试图用 cache.has_key('test')
找到密钥,但仍然无法确定视图密钥的命名方式。
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 cache.all()
or something. I've been trying to find the key with cache.has_key('test')
but still cant figure out how the view keys are being named.
更新:我需要这个的原因是因为我需要手动删除部分缓存,但不知道Django正在为我的cache_view键设置的关键值
UPDATE: The reason I need this is because I need to manually delete parts of the cache but dont know the key values Django is setting for my cache_view key
推荐答案
您可以使用 http://www.darkcoding.net/software/memcached-list-all-keys/ ,如如何使用Python memcached检查Django缓存的内容?
这篇关于获取Django中的Cache Keys列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!