Skip to main content

Cache any python object to file using improved pickling .

Project description

https://badge.fury.io/py/anycache.svg https://travis-ci.org/c0fec0de/anycache.svg?branch=master https://coveralls.io/repos/github/c0fec0de/anycache/badge.svg https://readthedocs.org/projects/anycache/badge/?version=1.0.0 https://codeclimate.com/github/c0fec0de/anycache.png https://img.shields.io/pypi/pyversions/anycache.svg https://landscape.io/github/c0fec0de/anycache/master/landscape.svg?style=flat https://img.shields.io/badge/code%20style-pep8-brightgreen.svg https://img.shields.io/badge/code%20style-pep257-brightgreen.svg

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


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 details)

Uploaded Source

File details

Details for the file anycache-1.0.0.tar.gz.

File metadata

  • Download URL: anycache-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for anycache-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ad5d0069edf913b195c2bca83092f5d214cef272b23241f357eb78793cb32bca
MD5 abaa49d35c78a17139a5f256bbacf208
BLAKE2b-256 82623d2cd6b30f540788bc3d28f8f2befa03a304865842946588c8af298aef7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page