Skip to content
Wrapper for the django cache api to gracefully handle long or non-ascii keys
Python
Find file
Latest commit 0a42e3f @stefanor stefanor Merge pull request #1 from yola/distribution
Distribution things
Failed to load latest commit information.
hashcache Get things to a usable, documented state.
tests
.gitignore gitignore egg-info
.travis.yml Travis CI config
LICENSE Add LICENSE file (MIT).
MANIFEST.in MANIFEST.in, so that LICENSE is included in distributions
README.md Improve attribution in the readme.
dev_requirements.txt Get things to a usable, documented state.
setup.py Generic e-mail address

README.md

Hashcache

A wrapper for django's low-level cache api that cleans and hashes the keys to get around encoding and key length issues when using picky cache stores (like memcached...).

Normal Usage

>>> from hashcache import hashcache
>>> hashcache.set('my_key', 'hello, world!', 30)
>>> hashcache.get('my_key')
'hello, world!'

Advanced usage

If you want to get crazy, you can pass in your own cache module that conforms to django's cache api:

>>> from hashcache import Hashcache
>>> cache = Hashcache(my_special_cache)
>>> cache.set('my_key', 'hello, world!', 30)
>>> cache.get('my_key')
'hello, world!'

Tests

Tests are written using the Testify testing framework. To run them, from the root of the project, install the development dependencies:

pip install -r dev_requirements.txt

and run:

testify tests

Everything else

Written and used by the folks at Yola. Check out our free website builder today.

Something went wrong with that request. Please try again.