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/2.0.7/
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
anycache caches nearly any python object. Also lambda statements. It uses Dill as backend. An improved version of pythons build-in pickle.
To preserve the result between multiple python runs, a persistent cache directory needs to be set.
>>> from anycache import anycache >>> @anycache(cachedir='/tmp/anycache.my') ... def myfunc(posarg, kwarg=3): ... return posarg + kwarg
The AnyCache object serves additional functions for cache clearing and size handling.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anycache-2.0.7.tar.gz.
File metadata
- Download URL: anycache-2.0.7.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e372dece09eba8733e8e08873da8d7793bfee8fc9457c657bb054d3bfa25ff
|
|
| MD5 |
8f1be40ccf11c1cf00443127753f91b8
|
|
| BLAKE2b-256 |
f5fd997bcb31ca2351bc6ded3dbb301590c32670d9bca832e5415c1667c20d8d
|
File details
Details for the file anycache-2.0.7-py2.py3-none-any.whl.
File metadata
- Download URL: anycache-2.0.7-py2.py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
606c4f3f938f32634261458357a0ccb2a6aa30521aacb1fd7d8c7cfefedefea3
|
|
| MD5 |
5400949ae807cff6fea28e2fb4fd7436
|
|
| BLAKE2b-256 |
429417de24bff0b10c5e40e029f9dfbf34f7c5fd381d1cda3bc2c736b162b772
|