This repository was archived by the owner on Jan 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-16
lines changed
Expand file tree Collapse file tree 3 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -33,25 +33,24 @@ public function __construct(Cache $cache)
3333 public function collect (Request $ request , Response $ response , \Exception $ exception = null )
3434 {
3535 $ size = 0 ;
36+ $ stats = [];
3637 /** @var $cache */
37- foreach ($ this ->cache ->getInstances () as $ cache ) {
38+ foreach ($ this ->cache ->getInstances () as $ name => $ cache ) {
3839 if ($ cache ->getStats ()->getSize ()) {
3940 $ size += $ cache ->getStats ()->getSize ();
4041 }
42+ $ stats [$ name ] = $ cache ->getStats ();
4143 }
44+
4245 $ this ->data = [
43- 'caches ' => $ this -> cache -> getInstances () ,
44- 'size ' => $ size,
46+ 'stats ' => $ stats ,
47+ 'size ' => $ size
4548 ];
4649 }
4750
48- public function getCaches ()
51+ public function getStats ()
4952 {
50- /**
51- * @var $name
52- * @var ExtendedCacheItemPoolInterface $cache
53- */
54- return $ this ->data ['caches ' ];
53+ return $ this ->data ['stats ' ];
5554 }
5655
5756 public function getSize ()
@@ -65,6 +64,6 @@ public function getSize()
6564
6665 public function getName ()
6766 {
68- return 'phpfastcache.request_collector ' ;
67+ return 'phpfastcache ' ;
6968 }
7069}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ services:
1818 -
1919 name : data_collector
2020 template : ' @phpFastCache/data_collector/template.html.twig'
21- id : ' phpfastcache.request_collector '
21+ id : ' phpfastcache'
2222 priority : 300
2323
2424 phpfastcache.human_readable_size :
Original file line number Diff line number Diff line change 66 <span class =" sf-toolbar-value" >{{ collector .size | sizeFormat(1 ) }}</span >
77 {% endset %}
88
9+ {% set text %}
10+ <div class =" sf-toolbar-info-piece" >
11+ <b >Cache instances</b >
12+ <span >{{ collector .stats | length }}</span >
13+ </div >
14+ {% endset %}
15+
916 {{ include (' @WebProfiler/Profiler/toolbar_item.html.twig' ) }}
1017{% endblock %}
1118
1825
1926{% block panel %}
2027 <div class =" sf-tabs" >
21- {% for name , cache in collector .caches %}
28+ {% for name , stat in collector .stats %}
2229 <div class =" tab" >
2330 <h3 class =" tab-title" >{{ name }}</h3 >
2431 <div class =" tab-content" >
2532 <table class =" {{ class | default (' ' ) }}" >
2633 <tbody >
2734 <tr >
2835 <th >Info</th >
29- <td >{{ cache . stats .info }}</td >
36+ <td >{{ stat .info }}</td >
3037 </tr >
3138 <tr >
3239 <th >Size</th >
33- <td >{{ cache . stats .size | sizeFormat(1 ) }}</td >
40+ <td >{{ stat .size | sizeFormat(1 ) }}</td >
3441 </tr >
3542 <tr >
3643 <th >Data</th >
37- <td >{{ cache . stats .data }}</td >
44+ <td >{{ stat .data }}</td >
3845 </tr >
3946 <tr >
4047 <th >RawData</th >
41- <td >{{ dump (cache . stats .rawData ) }}</td >
48+ <td >{{ dump (stat .rawData ) }}</td >
4249 </tr >
4350 </tbody >
4451 </table >
You can’t perform that action at this time.
0 commit comments