Keysmith
1.x
Docs/Keysmith/Memory Store
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/stores/memory.mdx

The memory store provides a full store.Store implementation backed by Go maps and sync.RWMutex. It requires no external dependencies and is ideal for testing and development.

Setup01

import "github.com/xraph/keysmith/store/memory"

store := memory.New()

Features02

  • Implements the complete store.Store composite interface (keys, policies, scopes, usage, rotation)

  • Thread-safe via sync.RWMutex

  • O(1) key lookup by hash via secondary index

  • Key-scope junction tracking for scope assignment

  • No external dependencies

Usage with the engine03

eng, err := keysmith.NewEngine(keysmith.WithStore(memory.New()))

Limitations04

  • Data is lost when the process exits

  • Not suitable for production use

  • No persistence, replication, or backup support

  • Single-process only (no multi-instance coordination)

When to use05

ScenarioRecommended
Unit testsYes
Integration testsYes
Local developmentYes
CI pipelinesYes
ProductionNo -- use PostgreSQL