fusionbox/django-fusionbox — pull request #56 by gavinwahl (2012-11-07 21:21:19+00:00)
Title: Add @cached() decorator

Caches a function's return value based on its arguments.

@cached(lambda a, b, date: [str(a), str(b), date.isoformat()])
def generate_report(a, b, date):
return frobnicate(
slow_api_call(a, date),
slow_api_call(b, date),
munge(process_range(a, b)),
)