Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

35 Commits

Repository files navigation

rememberer

Rememberer is a tool to help your functions remember their previous results.

The advantage of this package compared to other memoization packages is that it will remember the result of the function even if you kill the program and restart it.

It will also remember the result even if you restart the python interpreter because it uses a pickle file to store the results.

Installation

pip install rememberer

Usage

fromremembererimportremdefadd(a, b):
importtimetime.sleep(3)
returna+brem(add, 1, b=2) # this will take 3 secondsrem(add, 1, b=2) # this will take ~0 seconds

You can use it as a decorator as well:

fromremembererimportrem_dec@rem_decdefadd(a, b):
importtimetime.sleep(3)
returna+badd(1, b=2) # this will take 3 secondsadd(1, b=2) # this will take ~0 seconds

If you want to clear the cache, you can use the forget method:

fromremembererimportforgetforget(add, 1, b=2)

About

Rememberer is a python package to help your functions remember their previous results.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages