django-mongodb-cash-backend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alireza Savand 2455ce9868
Merge pull request #4 from Olivier-OH/master
1 year ago
django_mongodb_cash_backend Removed a left out a print statement for debug 1 year ago
.gitignore Inital version of django_mongodb_cash_backend 6 years ago
AUTHORS.rst Fix a typo 5 years ago
ChangeLog.rst Update changelog, setup.py 4 years ago
LICENSE Inital version of django_mongodb_cash_backend 6 years ago
MANIFEST.in Inital version of django_mongodb_cash_backend 6 years ago
README.rst Use mongo's TTL index or capped collections for auto cache culling (updated README) 1 year ago
requirements.txt Update requirements and version 1 year ago
setup.py Update requirements and version 1 year ago

README.rst

Django MongoDB Cash Backend
===========================

The only Django MongoDB Cache backend you need.

Installation and Usage
----------------------
Install with:

``pip install django-mongodb-cash-backend``

Add the following to your Django settings::

CACHES = {
'default': {
'BACKEND': 'django_mongodb_cash_backend.MongoDBCache',
"LOCATION": "hostname[:port]",
"OPTIONS": {
"USERNAME": "username_if_desired",
"PASSWORD": "password_if_needed",
"DATABASE": "cache_db_name",
"COLLECTION": "cache_colleciton", # default: django_cache
},
"TIMEOUT": 86400, # either set TIMEOUT or MAX_ENTRIES, not both
"MAX_ENTRIES": 10000, # either set MAX_ENTRIES or TIMEOUT, not both
}
}


Tips and hints
--------------

Django MongoDB cash backend will handle TTL index creation, or will create a capped collection if MAX_ENTRIES is set. You should ensure that the collections are not created beforehands, so that the backend can do its work correctly.