langacore.kit.common 0.2.4 documentation
Implements a reusable memoization decorator. It is using a finite-size cache with pickled arguments as keys, to hold the outcome of a specific function call. When the decorated function is called again with the same arguments, the outcome is fetched from the cache instead of being recalculated again.
The cache used maintains a list of Least Recently Used keys so that in case of overflow only the seemingly least important ones get deleted.
Note
Instead of importing the whole structure, a recommended shortcut is available. Use from langacore.kit.cache import memoize.
Memoization decorator.
Parameters: |
|
---|