This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django Gzipping Cache

The Django Gzipping Cache is a transparent wrapper of django caches that gzips values before they are sent to the underlying cache.

Django Gzipping Cache is released under the BSD license, like Django. If you like it, please consider contributing!

Use

The gzipping cache is declared like so:

CACHES = {
    ...
    'my_cache': {
        'BACKEND': 'django_gzipping_cache.cache.GzippingCache',
        'LOCATION': '_my_cache'
    },
    '_my_cache': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'snowflake'
    },
    ...
})

This will create 2 caches, one is a standard LocMemCache (though GzippingCache will wrap any django cache) and the other is a gzip cache. Here’s a sample iPython run with the above:

In [1]: from django.core.cache import get_cache

In [2]: my_cache = get_cache('my_cache')

In [3]: _my_cache = get_cache('_my_cache')

In [4]: my_cache.set('foo', 'bar')

In [5]: my_cache.get('foo')
Out[5]: 'bar'

In [6]: _my_cache.get('foo')
Out[6]: 'x\x9cKJ,\x02\x00\x02]\x016'

Obviously, you should not use the GzippingCache for small strings as gzip output can be longer.

Configuration

GzippingCache takes 2 additional parameters, the default configuration is:

CACHES = {
    ...
    'my_cache': {
        'BACKEND': 'django_gzipping_cache.cache.GzippingCache',
        'LOCATION': '_my_cache'
        'COMPRESS_LEVEL': 6,
        'PASS_UNCOMPRESSED': False,
    },
    ...
})

COMPRESS_LEVEL is the number from 1-9 that tells zlib how aggressively to compress, higher numbers take more CPU in order to achieve smaller output.

PASS_UNCOMPRESSED is for storing compressed and uncompressed data in the same underlying cache. This is not recommended. If PASS_UNCOMPRESSED is set to True and a piece of data fails a CRC check, the data will be returned. If the data was corrupted this will most likely result in your application misbehaving.

Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-gzipping-cache-0.1.0.tar.gz (6.7 kB) Copy SHA256 Checksum SHA256 Source Feb 21, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting