唯一需要的django mongodb缓存后端。
django-mongodb-cash-backend的Python项目详细描述
唯一需要的django mongodb缓存后端。
安装和使用
安装时使用:
pip install django-mongodb-cash-backend
在django设置中添加以下内容:
CACHES = { 'default': { 'BACKEND': 'django_mongodb_cash_backend.MongoDBCache', "LOCATION": "DEFAULT", "TIMEOUT": 86400, "OPTIONS": { "HOST": "MongoDB_host", "PORT": 12345, "USERNAME": "username_if_desired", "PASSWORD": "password_if_needed" }, } }
提示
在MongoDB数据库中,应该考虑创建索引 在“Expires”字段中。剔除旧的缓存条目将非常重要 速度更快,整体性能提升。