Cache any python object to file using improved pickling .
Project description
Cache any python object to file using improved pickling
Documentation
The Documentation is hosted on http://anycache.readthedocs.io/en/1.0.0/
Getting started
To cache the result of a function, use the global unlimited anycache:
>>> from anycache import anycache >>> @anycache() ... def myfunc(posarg, kwarg=3): ... print(" Calcing %r + %r = %r" % (posarg, kwarg, posarg + kwarg)) ... return posarg + kwarg >>> myfunc(8, 5) Calcing 8 + 5 = 13 13 >>> myfunc(8, 5) 13
To preserve the result between multiple python runs, a persistent cache directory needs to be set at a central AnyCache instance.
>>> from anycache import AnyCache >>> ac = AnyCache(cachedir='/tmp/anycache.my') >>> @ac.anycache() ... def myfunc(posarg, kwarg=3): ... return posarg + kwarg
Installation
To install the anycache module run:
pip install anycache
If you do not have write-permissions to the python installation, try:
pip install anycache --user
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anycache-1.0.0.tar.gz
(5.5 kB
view hashes)