User Guide

Everything you need to install, configure, and build with Montycat — from getting started to governance, advanced operations, and security.

Montycat provides snapshotting capabilities for in-memory keyspaces, enabling you to persist their state to disk without sacrificing performance.
Snapshots are incremental and efficient—they are only triggered when changes (insertions, updates, or deletions) occur within a keyspace.
Snapshots serve as periodic checkpoints: they capture the current state of a keyspace according to the interval you configure.
On startup, in-memory indexes are not loaded from snapshots but reconstructed in the background, ensuring full data consistency.

You control snapshotting with two levels of configuration:

  • Global snapshot rate: Defines the system-wide interval (in seconds) at which Montycat checks for changes and writes updated snapshots to disk.
  • Per-keyspace snapshot settings: Enable, disable, or clean snapshots on a per-keyspace basis.

montycat snapshot-rate 60

or

montycat console
> snapshot-rate 60

exit

or set it in Docker:

FROM montygovernance/montycat:latest

# MONTYCAT_SNAPSHOT_RATE default is 0 seconds (snapshot disabled)
# Override it by setting it to your desired value in seconds
# Setting it to 0 will disable snapshots
# It's recommended to set it to at least 60 seconds for production systems

ENV MONTYCAT_SNAPSHOT_RATE=60

You can also set the snapshot rate directly from the client (requires superowner credentials):

# Set the DB-wide snapshot rate in seconds (0 disables snapshots).
# Requires superowner credentials.
await connection.set_snapshot_rate(60)

# {"status": True, "payload": "Snapshot rate updated", "error": None}

You can enable snapshotting for individual in-memory keyspaces.

montycat console
> do-snapshots-for-keyspace store <store name> keyspace <keyspace name>

exit
from montycat import Keyspace
from connection import connection #connection.py

class EmployeesInMem(Keyspace.InMemory):
    keyspace = "EmployeesInMem"

EmployeesInMem.connect_engine(connection)

res = await EmployeesInMem.do_snapshots_for_keyspace()

You can selectively disable snapshotting for some keyspaces while keeping it enabled for others.
When disabled, Montycat preserves the last saved snapshot but does not create new ones.

montycat console
> stop-snapshots-for-keyspace store <store name> keyspace <keyspace name>

exit
from montycat import Keyspace
from keyspaces import EmployeesInMem

res = await EmployeesInMem.stop_snapshots_for_keyspace()

Cleaning snapshots removes the last saved state of a keyspace from disk.
This operation is destructive, so it should be used with caution.

montycat console
> clean-snapshots-for-keyspace store <store name> keyspace <keyspace name>

exit
from keyspaces import EmployeesInMem #keyspaces.py

res = await EmployeesInMem.clean_snapshots_for_keyspace()