{% from "leeuwenhoek/_macros.html" import duration, time_ago, json_tree %}
{% macro result_tag(c) -%}
{%- if c.hit is defined and c.hit is not none -%}
{%- if c.hit %}hit{% else %}miss{% endif -%}
{%- elif c.hits is defined -%}
{{ c.hits }} hits {{ c.misses }} misses
{%- endif -%}
{%- endmacro %}
{% macro keys(c, length=80) %}{% if c.operation == "clear" %}all keys{% else %}{{ c['keys'] | join(", ") | lw_truncate(length) }}{% endif %}{% endmacro %}
{% macro head() %}
{{ c.operation }} {{ result_tag(c) }} {{ c.duration_ms | lw_duration }} {%- if c.backend %} ยท {{ c.backend }}{% endif %}
| Keys | {% if c.operation == "clear" %}all keys{% else %}{% for k in c['keys'] %}{{ k }}{% if not loop.last %}{% endif %}{% endfor %}{% endif %} |
|---|---|
| TTL | {% if c.timeout is none %}backend default{% elif c.timeout == 0 %}never expires{% else %}{{ c.timeout }} s{% endif %} |
| Result | {{ c.result | tojson }} |
Values
{{ json_tree(c.get('values'), true) }}{% endif %} {% endmacro %}