niwibe/django-redis — pull request #98 by alanjds (2014-10-31 19:21:07+00:00)
Title: Option COMPRESS_MIN_LEN to compress values using zlib

Inspired by python-memcache, this adds the OPTIONs:

- COMPRESS_MIN_LEN: Minimum size to compress the values
- COMPRESS_COMPRESSOR: callable that compress the values,
- COMPRESS_DECOMPRESSOR: callable that decompress the values,
- COMPRESS_DECOMPRESSOR_ERROR: exception to be ignored when decompressing the values.

YMMV, but here this made possible a 60-70% reduction on real-world access cached with https://github.com/jmoiron/johnny-cache/

Before: https://rpm.newrelic.com/public/charts/j0qRCwRvtNq
After: https://rpm.newrelic.com/public/charts/hclMlVeb5Hb

Caveats:
- No tests and no docs for now.
- If you switch from compressed to non-compressed, you should clear you cache.