您需要的唯一Django MongoDB缓存后端。
项目描述
您需要的唯一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”字段上创建一个索引。删除旧缓存条目将会更快,整体性能也会得到提升。