Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Yet another cache backend for django. This one includes: memcache, mintcache and automatic key versioning for gracefull upgrades.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 debian
Octocat-spinner-32 test_versionedcache
Octocat-spinner-32 versionedcache
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 dev_requirements.txt
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
README
Django-versionedcache is a cache backend for Django that:

 - uses MintCache (inspired heavily by http://www.djangosnippets.org/snippets/155/)
 - prepends settings.VERSION to any cache keyto allow gracefull update - you
   can deploy new version of your application without the need for restarting
   your memcached - two versions of the same app can coexist on one memcached
   cluster.
 - to use
     - put versionedcache.backend in settings.CACHE_BACKEND where you
       would normaly use memcached, the rest is the same (IP adresses, ports and
       options to memcached are passed along)
     - maintain a VERSION string in your settings, when you change it,
       versionedcache will use it to identify cache keys belonging to that
       specific version, just change it on update to start using new set of keys
     - see tests/unit_test/settings for example usage

Django-versionedcache also includes a debugging cache backend that wraps
versionedcache backend and adds the following features:

 - ability (for supersusers only!) to turn the cache off per request
 - ability (for supersusers only!) to turn the cache to write-only mode

This is very usefull if you need to debug something on deoployed site and need
to turn the cache off to see the actual results immediately. Once you fix the
problem, you reload the page in write-only mode and the cache will get
overriden with what you saw and want.

To use just add 'versionedcache.middleware.CacheDebugMiddleware' after
'django.contrib.auth.middleware.AuthenticationMiddleware' in your
MIDDLEWARE_CLASSES and use versionedcache.debug:// scheme for your
CACHE_BACKEND with the same options you would use for versionedcache.backend or
memcached. Then when superuser supplies cache_debug=turn_off or
cache_debug=write_only get parameters to any URL it will take effect for that
request only.

Note: CacheDebugMiddleware is not thread safe
Something went wrong with that request. Please try again.