Installing it is pretty easy:
pip install 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)
13anycache 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 + kwargThe AnyCache object serves additional functions for cache clearing and
size handling.