2021년 1월 18일 월요일

Using the SetCacheHeaders middleware

 

  • no-cache and etag will allow the user to refresh the page (even before the expiration time) without downloading the whole page if the latest published podcasts are still the same.
  • private says the homepage is per-user, and should be cached only in the user device rather than, for example, a proxy.
  • max-age=300 will set an expiration time of 5 minutes, since after that time surely there is a new Podcast published.

Route::get('/', 'PodcastController@index')
->middleware('cache.headers:no-cache,private,max-age=300;etag');

댓글 없음:

댓글 쓰기