September 1, 2017

Very useful redis cache decorator in Python

Lets start from the end.

@cache('1h')
def func1(user_id):
    return heavy_compute(user_id)

result = func1(123)

Now our decorated func1 has some very useful methods!