Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 767 Bytes

File metadata and controls

31 lines (24 loc) · 767 Bytes

Cache Function

You can use this python decorator Github-flavored Markdown to cache a result of a function.

Installation

pip install -i https://test.pypi.org/simple/cache-function-deepakmishra

Usage

Production Setting

from cache_function import cache_function
cache_function.cache = **your cache object which has get and set functions**

Development Setting

from cache_function import cache_function, test_cache_function
cache_function.cache = test_cache_function.DummyCache()

Usage: Cache a function result

from cache_function.cache_function import cache_function

@cache_function(expiry=30) # time in seconds
def foo(a, b, c):
    return a + b + c