Skip to content

Instantly share code, notes, and snippets.

@sangdongvan
Created July 19, 2018 07:03
Show Gist options
  • Select an option

  • Save sangdongvan/31a7160ceaee8806436ec8c4f7fa4f34 to your computer and use it in GitHub Desktop.

Select an option

Save sangdongvan/31a7160ceaee8806436ec8c4f7fa4f34 to your computer and use it in GitHub Desktop.
stale_while_revalidate_seconds = settings.FRONTEND_CACHE_TIMEOUT / 2
three_days_in_seconds = 60 * 60 * 24 * 3
extra_cache_control_headers = {
'stale-while-revalidate=%s' % stale_while_revalidate_seconds,
'stale-if-error=%s' % three_days_in_seconds,
}
patch_cache_control(response, **extra_cache_control_headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment