Add caching to the changes api since it is so expensive and can return large results.

This commit is contained in:
yackob03 2013-10-20 01:18:31 -04:00
parent c90602e48d
commit 13b457c440
2 changed files with 14 additions and 0 deletions

12
util/cache.py Normal file
View file

@ -0,0 +1,12 @@
from functools import wraps
def cache_control(max_age=55):
def wrap(f):
@wraps(f)
def add_max_age(*args, **kwargs):
response = f(*args, **kwargs)
response.headers['Cache-Control'] = 'max-age=%d' % max_age
return response
return add_max_age
return wrap