"use client"; import { useState, useEffect } from "react"; import { Card } from "@/shared/components"; export default function CacheStatsCard() { const [cache, setCache] = useState(null); const [flushing, setFlushing] = useState(false); const fetchStats = () => { fetch("/api/cache/stats") .then((r) => r.json()) .then(setCache) .catch(() => {}); }; useEffect(fetchStats, []); const handleFlush = async () => { setFlushing(true); try { await fetch("/api/cache/stats", { method: "DELETE" }); fetchStats(); } finally { setFlushing(false); } }; return (

cached Prompt Cache

{cache ? (

Size

{cache.size}/{cache.maxSize}

Hit Rate

{cache.hitRate?.toFixed(1) ?? 0}%

Hits

{cache.hits ?? 0}

Evictions

{cache.evictions ?? 0}

) : (

Loading cache stats…

)}
); }