in kinto-remote-settings/src/kinto_remote_settings/changes/views.py [0:0]
def _handle_cache_expires(request, bid, cid):
# If the client sends cache busting query parameters, then we can cache more
# aggressively.
settings = request.registry.settings
prefix = f"{bid}.{cid}.record_cache"
default_expires = settings.get(f"{prefix}_expires_seconds")
maximum_expires = settings.get(f"{prefix}_maximum_expires_seconds", default_expires)
has_cache_busting = "_expected" in request.GET
cache_expires = maximum_expires if has_cache_busting else default_expires
if cache_expires is not None:
request.response.cache_expires(seconds=int(cache_expires))
elif bucket_expires := settings.get(f"{bid}.record_cache_expires_seconds"):
request.response.cache_expires(seconds=int(bucket_expires))
elif global_expires := settings.get("record_cache_expires_seconds"):
request.response.cache_expires(seconds=int(global_expires))