llm-cache

command
v0.48.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 6 Imported by: 0

README

llm-cache

A tiny content-addressed LLM prompt cache. Shows how four stdlib packages compose for a real-world local-state CLI:

Stdlib package What it does here
stdlib/sqlite + stdlib/db Schema, INSERT/SELECT/UPDATE/DELETE, db.Transaction
stdlib/crypto SHA256(model|prompt) cache keys
stdlib/datetime NowISO() timestamps, day-based prune cutoff
stdlib/cli Subcommand wiring with put/get/stats/prune

The get path is the interesting bit — SELECT response and UPDATE hit_count run inside a db.Transaction so concurrent readers can't double-count or observe a partial increment.

Run

kukicha run examples/llm-cache/ put --model claude --prompt "hello" --response "hi there"
kukicha run examples/llm-cache/ get --model claude --prompt "hello"
kukicha run examples/llm-cache/ stats
kukicha run examples/llm-cache/ prune --older-than-days 7

The cache lives in llm-cache.db next to where you run the command; override with --db /path/to/cache.db.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL