{% extends "base.html" %} {# CUI // SP-CTI — Cache Savings Dashboard (D-CACHE-VIS-1) #} {# NIST 800-53: SC-28 (Protection at Rest), AU-12 (Audit Record Generation), SA-11 (Developer Testing) #} {% block title %}Cache Savings — ICDEV™{% endblock %} {% set iqe_canvas = "cache_savings" %} {% set iqe_api_route = "/api/core/iqe-query" %} {% set iqe_title = "Query Cache Stats" %} {% set iqe_examples = [ {"label": "Hit rate by function", "query": "SELECT function, hit_rate_pct FROM cache.stats ORDER BY hit_rate_pct DESC"}, {"label": "Top functions by hits", "query": "SELECT function, total_hits, avoided_calls FROM cache.stats ORDER BY total_hits DESC LIMIT 10"}, {"label": "Cost savings breakdown", "query": "SELECT function, cost_usd_saved FROM cache.stats ORDER BY cost_usd_saved DESC"}, ] %} {% block content %}
Cache Savings {{ "ENABLED" if stats.enabled else "DISABLED" }} backend: {{ stats.backend }} JSON API ↗
{{ stats.summary.hit_rate_pct|round(1) }}%
Cache Hit Rate
{{ "{:,}".format(stats.summary.total_entries) }}
Cached Entries
{{ "{:,}".format(stats.summary.total_hits) }} total hits
{{ "{:,}".format(stats.summary.cache_read_tokens) }}
Context Cache Reads
{{ "{:,}".format(stats.summary.cache_write_tokens) }} written
${{ "%.4f"|format(stats.summary.total_usd_saved) }}
Estimated Savings (USD)
resp: ${{ "%.4f"|format(stats.summary.resp_cache_usd_saved) }} + ctx: ${{ "%.4f"|format(stats.summary.context_cache_usd_saved) }}
{% if stats.by_function %}
By Function
{% for fn in stats.by_function %} {% endfor %}
Function Entries Hit Rate Avoided Calls Read Tokens Cost Saved
{{ fn.function }} {{ "{:,}".format(fn.total_entries) }} {{ fn.hit_rate_pct }}% {{ "{:,}".format(fn.avoided_calls) }} {{ "{:,}".format(fn.cache_read_tokens) }} ${{ "%.4f"|format(fn.cost_usd_saved) }}
{% else %}
No cached entries yet. Cache activates after the first LLM invocation on an enabled function.
{% endif %} {% include "includes/iqe_query_widget.html" %}
Pricing model: Anthropic claude-sonnet-4-6 — Input $3/MTok · Output $15/MTok · Cache write $3.75/MTok · Cache read $0.30/MTok. Context cache savings = read_tokens × ($3.00 − $0.30)/MTok minus write premium. Response cache savings = avoided_calls × (input_cost + output_cost) per entry. NIST 800-53: SC-28, AU-12, SA-11.
{% endblock %}