django中locmem缓存的内容? [英] Contents of locmem cache in django?

查看:371
本文介绍了django中locmem缓存的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用locmem缓存作为我的Web应用程序,但找不到有关如何获取缓存内容的具体文档。我的意思是我想检查我的密钥是否正确设置在缓存中。如何列出这个缓存中的所有密钥?甚至可以列出这些密钥?

I was trying to use locmem cache for my web application but couldn't find any concrete documentation on how can i get the contents of the cache. I mean I want to check if my keys are being set correctly in the cache. How can I list all the keys in this cache or is that even possible?

获取Django中的缓存键列表

这是我为memcache找到的但是对于locmem缓存来说没有什么?

This is what i found for memcache but nothing for locmem cache?

PS:我刚刚在django中使用缓存,所以我可能会丢失一些东西。任何人都可以引用我一个好的文档?

P.S.: I am new to using cache in django so I might be missing a few things. Can anyone refer me to a good documentation?

推荐答案

关于locmem的事情是,它只是一个本地的内存存储。看代码,它是清除该模块中的数据只被保存在模块级变量 _caches 中。所以你可以从django.core.cache.backends导入locmem
打印locmem._caches $ b $

The thing about locmem is that it really is just a local memory storage. Looking at the code, it's clear that the data is just being saved in a module-level variable, _caches, in that module. So you can just do

from django.core.cache.backends import locmem
print locmem._caches

这篇关于django中locmem缓存的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆