Pythod Cached Decorator providing caching for functions
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Python Cached Decorator

MIT license

Provides caching for functions

  • Suitable for time consuming computations
  • How does it work:
    • First run = run
    • Second run = load result
  • Stores result in pickle
  • Checks if function args matches
  • Always use newest result


from Cached import Cached

# possible params: Cached(force_run=False, output_path="cached_data", name="")
def func(arg):
    return arg

print fun(5)


All options are optional

  • force_run [True/False] Do not use cached result
  • output_path [String] default=cached_data in script path, /tmp is a good idea
  • name [String] default=function name, force function name - used for store and load


Feel free to contribute.

Copyright and License

© 2015 Vít Listík, Michal Bukovský

Released under MIT licence