An on-disk KV cache keeps sliding-window-attention (SWA) entries so that a shared prefix is not prefilled twice. Quantify three strategies for a prefix hit.
Implement swa_cache_strategies(prefix_len, n_win, p, num_layers, entry_bytes) (all integers: prefix length, window size, checkpoint period, layer count, bytes of one token's SWA entry in one layer). Let per_token = num_layers * entry_bytes.
"full": every token is written, prefix_len * per_token bytes; a hit reads the last window, min(n_win, prefix_len) * per_token bytes; 0 tokens recomputed."periodic": at token counts p, 2p, ..., k*p with k = prefix_len // p the last n_win tokens are written, so bytes_written is the sum over j = 1..k of min(n_win, j*p) * per_token. A hit loads the latest checkpoint c = k*p, min(n_win, c) * per_token bytes, and recomputes the prefix_len - c tail tokens. If c == 0, nothing is written or read and the recomputed count is that of "zero"."zero": nothing written or read; recompute min(prefix_len, n_win * num_layers) tokens (each layer's window depends only on the previous layer's window).Return {"full": {...}, "periodic": {...}, "zero": {...}}, each inner dict with integer values under "bytes_written", "bytes_read" and "tokens_recomputed".