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