We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 494d498 commit 601a579Copy full SHA for 601a579
src/flask_caching/__init__.py
@@ -26,6 +26,7 @@
26
27
from flask import current_app
28
from flask import Flask
29
+from flask import g
30
from flask import request
31
from flask import Response
32
from flask import url_for
@@ -414,10 +415,11 @@ def decorated_function(*args, **kwargs):
414
415
if found and self.app.debug:
416
logger.info(f"Cache used for key: {cache_key}")
417
if response_hit_indication:
418
+ g.flask_caching_hit_cache = found
419
420
def apply_caching(response):
- if found:
- response.headers["hit_cache"] = found
421
+ if g.flask_caching_hit_cache:
422
+ response.headers["hit_cache"] = g.flask_caching_hit_cache
423
return response
424
425
self.app.after_request_funcs[None].append(apply_caching)
0 commit comments