Changeset 256453 in webkit
- Timestamp:
- Feb 12, 2020 10:47:58 AM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r256432 r256453 1 2020-02-12 Jonathan Bedard <jbedard@apple.com> 2 3 results.webkit.org: Cache archive content 4 https://bugs.webkit.org/show_bug.cgi?id=207589 5 6 Reviewed by Aakash Jain. 7 8 * resultsdbpy/resultsdbpy/flask_support/util.py: 9 (cache_for): Add decorator function which sets the cache values on the returned response. 10 * resultsdbpy/resultsdbpy/view/archive_view.py: 11 (ArchiveView): Cache archive content client-side for 12 hours. 12 * resultsdbpy/resultsdbpy/view/archive_view_unittest.py: 13 (ArchiveViewUnittest.test_file): Verify that archived content is cached. 14 1 15 2020-02-12 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Tools/resultsdbpy/resultsdbpy/flask_support/util.py
r253721 r256453 115 115 return real_method 116 116 return decorator 117 118 119 def cache_for(hours=12): 120 def decorator(method): 121 def real_method(self=None, method=method, **kwargs): 122 if self: 123 response = method(self=self, **kwargs) 124 else: 125 response = method(**kwargs) 126 response.headers.add('Cache-Control', f'public,max-age={hours * 60 * 60}') 127 return response 128 129 real_method.__name__ = method.__name__ 130 return real_method 131 return decorator -
trunk/Tools/resultsdbpy/resultsdbpy/view/archive_view.py
r253721 r256453 27 27 from resultsdbpy.controller.configuration_controller import configuration_for_query 28 28 from resultsdbpy.controller.suite_controller import time_range_for_query 29 from resultsdbpy.flask_support.util import AssertRequest, query_as_kwargs, limit_for_query, boolean_query, query_as_string29 from resultsdbpy.flask_support.util import AssertRequest, boolean_query, cache_for, limit_for_query, query_as_kwargs, query_as_string 30 30 from resultsdbpy.view.site_menu import SiteMenu 31 31 … … 63 63 @configuration_for_query() 64 64 @time_range_for_query() 65 @cache_for(hours=12) 65 66 def extract( 66 67 self, path=None, format=None, -
trunk/Tools/resultsdbpy/resultsdbpy/view/archive_view_unittest.py
r253721 r256453 74 74 self.assertEqual(response.status_code, 200) 75 75 self.assertEqual(response.text, 'data') 76 self.assertEqual(response.headers.get('Cache-Control'), 'public,max-age=43200')
Note: See TracChangeset
for help on using the changeset viewer.