Login

Snippets by cmheisel

Snippet List

Safer cache key generation

If any cache keys you generate include user (staff or public) supplied data, they may: be too long, contain invalid characters (at least by memcache's standards), or both. This helper will sub out any invalid characters and md5 the key if it's too long. Additionally, it'll insert the CACHE_MIDDLEWARE_KEY_PREFIX from django.conf.settings for you. In your memcache instances are used by multiple applications (Django or otherwise) this can help ensure your keys are unique to that a particular app on a particular site.

  • memcache
  • cache
  • caching
Read More

Another Memcache Status View

This was inspired by [this memcache status snippet](http://www.djangosnippets.org/snippets/54/) However, this version uses the quasi-internal cache._cache.get_status(), and it compiles a list of stats for each server that you specify in your CACHE_BACKEND setting.

  • memcache
Read More

cmheisel has posted 2 snippets.