File tree Expand file tree Collapse file tree 2 files changed +6
-19
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,9 @@ class DataCollectorCompilerPass extends BaseCompilerPass
27
27
*/
28
28
protected function prepare ()
29
29
{
30
- $ this ->transformLoggableCachePools ();
31
-
32
30
$ collectorDefinition = $ this ->container ->getDefinition ('data_collector.cache ' );
33
-
34
31
$ serviceIds = $ this ->container ->findTaggedServiceIds ('cache.provider ' );
35
- foreach (array_keys ($ serviceIds ) as $ id ) {
36
- $ collectorDefinition ->addMethodCall ('addInstance ' , [$ id , new Reference ($ id )]);
37
- }
38
-
39
- $ this ->container ->setDefinition ('data_collector.cache ' , $ collectorDefinition );
40
- }
41
32
42
- /**
43
- * Make all cache providers loggable.
44
- */
45
- private function transformLoggableCachePools ()
46
- {
47
- $ serviceIds = $ this ->container ->findTaggedServiceIds ('cache.provider ' );
48
33
foreach (array_keys ($ serviceIds ) as $ id ) {
49
34
50
35
// Duplicating definition to $originalServiceId.logged
@@ -56,6 +41,7 @@ private function transformLoggableCachePools()
56
41
57
42
// Overwrite the original service id with the new LoggingCachePool instance
58
43
$ this ->container ->setAlias ($ id , $ id .'.logger ' );
44
+ $ collectorDefinition ->addMethodCall ('addInstance ' , [$ id , new Reference ($ id .'.logger ' )]);
59
45
}
60
46
}
61
47
}
Original file line number Diff line number Diff line change @@ -63,14 +63,15 @@ public function match($pathInfo)
63
63
$ method = strtolower ($ this ->context ->getMethod ());
64
64
$ key = 'route_ ' .$ method .'_ ' .$ host .'_ ' .$ pathInfo ;
65
65
66
- if ($ this ->cachePool ->hasItem ($ key )) {
67
- return $ this ->cachePool ->getItem ($ key )->get ();
66
+ $ cacheItem = $ this ->cachePool ->getItem ($ key );
67
+ if ($ cacheItem ->isHit ()) {
68
+ return $ cacheItem ->get ();
68
69
}
69
70
70
71
$ match = parent ::match ($ pathInfo );
71
- $ item = $ this ->cachePool ->getItem ($ key );
72
- $ item ->set ($ match )
72
+ $ cacheItem ->set ($ match )
73
73
->expiresAfter ($ this ->ttl );
74
+ $ this ->cachePool ->save ($ cacheItem );
74
75
75
76
return $ match ;
76
77
}
You can’t perform that action at this time.
0 commit comments