Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit dc082bf

Browse files
committed
Added API Version to profiler
1 parent 7ef681f commit dc082bf

File tree

2 files changed

+48
-24
lines changed

2 files changed

+48
-24
lines changed

DataCollector/CacheCollector.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace phpFastCache\Bundle\DataCollector;
44

5+
use phpFastCache\Api as phpFastCacheApi;
56
use phpFastCache\Bundle\Service\Cache;
67
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
78
use phpFastCache\CacheManager;
@@ -52,6 +53,7 @@ public function collect(Request $request, Response $response, \Exception $except
5253
}
5354

5455
$this->data = [
56+
'apiVersion' => phpFastCacheApi::getVersion(),
5557
'driverUsed' => $driverUsed,
5658
'instances' => $instances,
5759
'stats' => $stats,
@@ -61,7 +63,7 @@ public function collect(Request $request, Response $response, \Exception $except
6163
'write' => (int) CacheManager::$WriteHits,
6264
],
6365
'coreConfig' => [
64-
'namespacePath' => CacheManager::getNamespacePath()
66+
'namespacePath' => CacheManager::getNamespacePath()
6567
],
6668
];
6769
}
@@ -114,6 +116,14 @@ public function getCoreConfig()
114116
return $this->data[ 'coreConfig' ];
115117
}
116118

119+
/**
120+
* @return mixed
121+
*/
122+
public function getApiVersion()
123+
{
124+
return $this->data[ 'apiVersion' ];
125+
}
126+
117127

118128
/**
119129
* @return string

Resources/views/data_collector/template.html.twig

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,41 @@
77
{% endset %}
88

99
{% set text %}
10-
<div class="sf-toolbar-info-piece">
11-
<b>Cache instances</b>
12-
<span class="sf-toolbar-status">{{ collector.stats|length }}</span>
13-
</div>
14-
<div class="sf-toolbar-info-piece">
15-
<b>Cache Size</b>
16-
<span class="sf-toolbar-status">{{ collector.size|sizeFormat(1) }}</span>
17-
</div>
18-
<div class="sf-toolbar-info-piece">
19-
<b>Read hits</b>
20-
<span class="sf-toolbar-status">{{ collector.hits.read }}</span>
10+
<div class="sf-toolbar-info-group">
11+
<div class="sf-toolbar-info-piece">
12+
<b>API version</b>
13+
<span class="sf-toolbar-status">{{ collector.ApiVersion }}</span>
14+
</div>
2115
</div>
22-
<div class="sf-toolbar-info-piece">
23-
<b>Write hits</b>
24-
<span class="sf-toolbar-status">{{ collector.hits.write }}</span>
16+
<div class="sf-toolbar-info-group">
17+
<div class="sf-toolbar-info-piece">
18+
<b>Read hits</b>
19+
<span class="sf-toolbar-status">{{ collector.hits.read }}</span>
20+
</div>
21+
<div class="sf-toolbar-info-piece">
22+
<b>Write hits</b>
23+
<span class="sf-toolbar-status">{{ collector.hits.write }}</span>
24+
</div>
2525
</div>
26-
<div class="sf-toolbar-info-piece">
27-
<b>Cache Driver</b>
28-
{% if collector.driverUsed|length == 0 %}
29-
<span>None</span>
30-
{% elseif collector.driverUsed|length == 1 %}
31-
<span><abbr title="{{ collector.driverUsed|first }}">{{ collector.driverUsed|keys|first }}</abbr></span>
32-
{% else %}
33-
<span>Multiple ({{ collector.driverUsed|length }})</span>
34-
{% endif %}
26+
<div class="sf-toolbar-info-group">
27+
<div class="sf-toolbar-info-piece">
28+
<b>Cache instances</b>
29+
<span class="sf-toolbar-status">{{ collector.stats|length }}</span>
30+
</div>
31+
<div class="sf-toolbar-info-piece">
32+
<b>Cache size</b>
33+
<span class="sf-toolbar-status">{{ collector.size|sizeFormat(1) }}</span>
34+
</div>
35+
<div class="sf-toolbar-info-piece">
36+
<b>Cache Driver</b>
37+
{% if collector.driverUsed|length == 0 %}
38+
<span>None</span>
39+
{% elseif collector.driverUsed|length == 1 %}
40+
<span><abbr title="{{ collector.driverUsed|first }}">{{ collector.driverUsed|keys|first }}</abbr></span>
41+
{% else %}
42+
<span>Multiple ({{ collector.driverUsed|length }})</span>
43+
{% endif %}
44+
</div>
3545
</div>
3646

3747
{% endset %}
@@ -75,6 +85,10 @@
7585
<span class="value"> {{ collector.hits.write }}</span>
7686
<span class="label">Write hits</span>
7787
</div>
88+
<div class="metric">
89+
<span class="value"> {{ collector.apiVersion }}</span>
90+
<span class="label">API Version</span>
91+
</div>
7892
</div>
7993

8094
<h2>PhpFastCache Cache Instance</h2>

0 commit comments

Comments
 (0)