We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 218e080 commit 2b25a7cCopy full SHA for 2b25a7c
src/Routing/RouterListener.php
@@ -54,6 +54,7 @@ public function onBeforeRouting(GetResponseEvent $event)
54
}
55
56
$request->attributes->add($item->get());
57
+ $request->attributes->set('_cache_hit', true);
58
59
60
/**
@@ -70,11 +71,14 @@ public function onAfterRouting(GetResponseEvent $event)
70
71
return;
72
73
- $item = $this->getCacheItem($request);
74
- if ($item->isHit()) {
+ if ($request->attributes->has('_cache_hit')) {
75
+ $request->attributes->remove('_cache_hit');
76
+ // object is in cache all ready
77
78
79
80
+ // Save to the cache
81
+ $item = $this->getCacheItem($request);
82
$item->set($request->attributes->all());
83
$this->cache->save($item);
84
0 commit comments