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)
33
33
public function collect (Request $ request , Response $ response , \Exception $ exception = null )
34
34
{
35
35
$ size = 0 ;
36
+ $ stats = [];
36
37
/** @var $cache */
37
- foreach ($ this ->cache ->getInstances () as $ cache ) {
38
+ foreach ($ this ->cache ->getInstances () as $ name => $ cache ) {
38
39
if ($ cache ->getStats ()->getSize ()) {
39
40
$ size += $ cache ->getStats ()->getSize ();
40
41
}
42
+ $ stats [$ name ] = $ cache ->getStats ();
41
43
}
44
+
42
45
$ this ->data = [
43
- 'caches ' => $ this -> cache -> getInstances () ,
44
- 'size ' => $ size,
46
+ 'stats ' => $ stats ,
47
+ 'size ' => $ size
45
48
];
46
49
}
47
50
48
- public function getCaches ()
51
+ public function getStats ()
49
52
{
50
- /**
51
- * @var $name
52
- * @var ExtendedCacheItemPoolInterface $cache
53
- */
54
- return $ this ->data ['caches ' ];
53
+ return $ this ->data ['stats ' ];
55
54
}
56
55
57
56
public function getSize ()
@@ -65,6 +64,6 @@ public function getSize()
65
64
66
65
public function getName ()
67
66
{
68
- return 'phpfastcache.request_collector ' ;
67
+ return 'phpfastcache ' ;
69
68
}
70
69
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ services:
18
18
-
19
19
name : data_collector
20
20
template : ' @phpFastCache/data_collector/template.html.twig'
21
- id : ' phpfastcache.request_collector '
21
+ id : ' phpfastcache'
22
22
priority : 300
23
23
24
24
phpfastcache.human_readable_size :
Original file line number Diff line number Diff line change 6
6
<span class =" sf-toolbar-value" >{{ collector .size | sizeFormat(1 ) }}</span >
7
7
{% endset %}
8
8
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
+
9
16
{{ include (' @WebProfiler/Profiler/toolbar_item.html.twig' ) }}
10
17
{% endblock %}
11
18
18
25
19
26
{% block panel %}
20
27
<div class =" sf-tabs" >
21
- {% for name , cache in collector .caches %}
28
+ {% for name , stat in collector .stats %}
22
29
<div class =" tab" >
23
30
<h3 class =" tab-title" >{{ name }}</h3 >
24
31
<div class =" tab-content" >
25
32
<table class =" {{ class | default (' ' ) }}" >
26
33
<tbody >
27
34
<tr >
28
35
<th >Info</th >
29
- <td >{{ cache . stats .info }}</td >
36
+ <td >{{ stat .info }}</td >
30
37
</tr >
31
38
<tr >
32
39
<th >Size</th >
33
- <td >{{ cache . stats .size | sizeFormat(1 ) }}</td >
40
+ <td >{{ stat .size | sizeFormat(1 ) }}</td >
34
41
</tr >
35
42
<tr >
36
43
<th >Data</th >
37
- <td >{{ cache . stats .data }}</td >
44
+ <td >{{ stat .data }}</td >
38
45
</tr >
39
46
<tr >
40
47
<th >RawData</th >
41
- <td >{{ dump (cache . stats .rawData ) }}</td >
48
+ <td >{{ dump (stat .rawData ) }}</td >
42
49
</tr >
43
50
</tbody >
44
51
</table >
You can’t perform that action at this time.
0 commit comments