Created
May 17, 2013 06:55
-
-
Save zhasm/5597388 to your computer and use it in GitHub Desktop.
django no cache decorator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def no_cache(): | |
def decorator(f): | |
def wrapper(*args, **kwargs): | |
response = f(*args, **kwargs) | |
response['Last-Modified'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()) | |
response['Expires'] = 'Wed, 11 Jan 1984 05:00:00 GMT' | |
response['Cache-Control'] = 'no-cache, must-revalidate, max-age=0' | |
response['Pragma'] = 'no-cache' | |
return response | |
return wrapper | |
return decorator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment