Skip to main content
Cache-Pot’s persistence commands let you manually trigger a snapshot save or compact the AOF at any time — useful before a planned restart, after a bulk import, or as part of a maintenance script. Cache-Pot supports two persistence mechanisms: point-in-time snapshots (enabled with --snapshot-path) and an append-only file (enabled with --aof-path). Both can be active simultaneously.

SAVE

Writes a full snapshot of the current keyspace to disk synchronously. The server serializes every key, hash, list, set, sorted set, and vector collection to the configured snapshot file before returning OK. Syntax: SAVE
SAVE   # OK
Returns: OK when the snapshot has been written successfully. Returns an error if no snapshot path is configured.
SAVE writes to the path set by --snapshot-path (default filename: cache-pot.snapshot). The server does not fork — it holds an in-process read lock across each keyspace shard while writing. Latency-sensitive workloads should schedule SAVE during low-traffic windows.
If Cache-Pot is started without --snapshot-path, SAVE returns ERR persistence is disabled (no snapshot path configured).

BGSAVE

Triggers a snapshot write using the same synchronous path as SAVE. The BG prefix is retained for Redis client compatibility — Cache-Pot does not fork a background process. Syntax: BGSAVE
BGSAVE   # OK
Returns: OK on success; the same error as SAVE if no snapshot path is configured.
Unlike Redis, Cache-Pot does not fork a child process for BGSAVE. The write is synchronous. The command name is kept so that backup scripts and monitoring tools designed for Redis work without changes.

BGREWRITEAOF

Compacts the append-only file by rewriting it to contain only the minimum set of commands needed to reconstruct the current keyspace state. This eliminates superseded writes and reduces the AOF file size. Syntax: BGREWRITEAOF
BGREWRITEAOF   # OK
Returns: OK when the rewrite completes. Returns an error if AOF is not enabled.
BGREWRITEAOF only has an effect when Cache-Pot is started with --aof-path. Without it, the command returns ERR AOF is disabled (no --aof-path configured).
Run BGREWRITEAOF after large batch imports or bulk deletes. A heavily fragmented AOF can be orders of magnitude larger than necessary; rewriting it speeds up future replays and reduces disk I/O during startup.