Snapshots
A snapshot is a complete, point-in-time copy of the keyspace written to a single file. Cache-Pot serialises all keys and values, writes the bytes to a temporary file, and then atomically renames that file into place — so you never see a half-written snapshot. Snapshots run automatically on a configurable interval and once more during graceful shutdown (onSIGINT or SIGTERM). On the next startup, Cache-Pot loads the snapshot file before accepting connections.
Configuration flags:
On-demand commands:
Set
--snapshot-path "" to run Cache-Pot as a purely ephemeral cache with no disk activity.Append-Only File (AOF)
The AOF records every write command as a RESP-encoded array, appended to a log file. On startup, Cache-Pot replays the log through the normal command-dispatch table to reconstruct the keyspace — no special restore logic needed. Two important details make AOF replay safe and idempotent:- Relative TTLs are normalised. Commands like
EXPIRE key 60orSET key val EX 300are logged as absolutePEXPIREATdeadlines, so replay produces the same expiry regardless of when it happens. SCACHE.SETis logged as its resultingVSET. Replaying a semantic-cache write never re-calls the embeddings API; the already-computed vector is logged directly.
Fsync policies:
Compaction:
Over time the AOF grows as it accumulates the full history of writes, including overwritten keys. Compact it to the minimal set of commands needed to reproduce the current live keyspace:
A compaction also runs automatically on graceful shutdown when
--aof-path is set.