mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add HIT/MISS result in cache profile call table
This commit is contained in:
@@ -32,11 +32,13 @@ class TraceableCache implements Cache, PhraseaCache
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
private function collect($type, $id)
|
||||
private function collect($type, $id, $hit = true, $result = null)
|
||||
{
|
||||
$this->calls[] = [
|
||||
'type' => $type,
|
||||
'key' => $id
|
||||
'key' => $id,
|
||||
'result' => $result,
|
||||
'hit' => (bool) $hit
|
||||
];
|
||||
}
|
||||
|
||||
@@ -65,9 +67,11 @@ class TraceableCache implements Cache, PhraseaCache
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
$this->collect('fetch', $id);
|
||||
$value = $this->cache->fetch($id);
|
||||
|
||||
return $this->cache->fetch($id);
|
||||
$this->collect('fetch', $id, $value != false, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -88,6 +88,7 @@
|
||||
<th>#</th>
|
||||
<th>Call type</th>
|
||||
<th>Key</th>
|
||||
<th>Hit / Miss</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -100,6 +101,7 @@
|
||||
{% if call['type'] != 'fetch' %}</strong>{% endif %}
|
||||
</td>
|
||||
<td>{{ call['key'] }}</td>
|
||||
<td>{% if call['hit'] %}HIT{% else %}<strong>MISS</strong>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user