Principle:1broseidon Ketch Per Operation Cache Handles
| Knowledge Sources | |
|---|---|
| Domains | Caching, Concurrency |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
A cache design in which the bbolt database file is opened only for each transaction and never held between operations, so the CLI, crawls, and concurrent MCP servers share the cache without locking each other out.
Theoretical Basis
A bbolt database holds a file lock for the lifetime of its handle. An MCP server that held the handle would lock the CLI out of the cache for the server's whole lifetime — and the server is designed to run indefinitely. The alternative (one handle per process) is the wrong granularity for a stateless CLI that comes and goes.
The design opens the file per transaction: each Get/Put opens the bbolt file, does its work, and closes it, releasing the lock. An idle server holds no lock; a lock held elsewhere costs one call a miss, not the server's whole lifetime. The trade is a small per-operation open cost for unconstrained concurrent access. The tag index follows the same rule (ADR-0006).
Usage
Use when a store must be shared across long-lived and short-lived processes and a held lock would block one from the other. Open per operation; never hold the handle between calls. Accept the per-op open cost as the price of lock-free sharing.