Skip to main content

Cache any python object to file using improved pickling

Project description

PyPI Version Python Build Documentation Coverage Status python-versions

Cache any python object to file using improved pickling

Installation

Installing it is pretty easy:

pip install anycache

Getting Started

>>> 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 built-in pickle.

To preserve the result between multiple python runs, set a persistent cache directory.

>>> 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.

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-2.4.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

anycache-2.4.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anycache-2.4.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.23.0 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for anycache-2.4.0.tar.gz
Algorithm Hash digest
SHA256 99d3da200c7890fc9bba2c6c05470d34789483ed0115ee2885b72753aa235629
MD5 2cd6cb6c673d003a08a18513c3ef49cf
BLAKE2b-256 a22f780bebd471b5a0fb9f53928d96726c7f17450d4d291a61e1b61988bab09c

See more details on using hashes here.

File details

Details for the file anycache-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: anycache-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.23.0 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for anycache-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e0fa7ea06e6929446a7805e28780038353a75067a26a4f79df97e886c982ca7
MD5 0b775fe8bac3dfb85df9864f2f97307a
BLAKE2b-256 cdbb0750b6253968c97646a5da67d203fa219e2fe1be3ace5e7615a29544e4b9

See more details on using hashes here.

Supported by

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