Enable client-side caching for the current request
(self)
| 51 | |
| 52 | # Various helpers |
| 53 | def enable_cache(self): |
| 54 | """Enable client-side caching for the current request""" |
| 55 | self.set_header('Cache-Control', 'max-age=%d, public' % CACHE_TIME) |
| 56 | |
| 57 | d = datetime.datetime.now() + datetime.timedelta(seconds=CACHE_TIME) |
| 58 | self.set_header('Expires', d.strftime('%a, %d %b %Y %H:%M:%S')) |
| 59 | |
| 60 | self.set_header('access-control-max-age', CACHE_TIME) |
| 61 | |
| 62 | def disable_cache(self): |
| 63 | """Disable client-side cache for the current request""" |