Chronicle
1.x
Docs/Chronicle/Memory Store
Open

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

The store/memory package provides a fully in-memory implementation of Chronicle's store.Store interface. It requires no external dependencies and is safe for concurrent use via sync.RWMutex.

When to use01

  • Unit tests and integration tests

  • Local development and examples

  • Prototyping before choosing a production backend

Not suitable for production — all data is lost when the process exits.

Import and constructor02

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

mem := memory.New()

New() returns a *memory.Store that implements all 6 sub-store interfaces plus Migrate, Ping, and Close. All three lifecycle methods are no-ops.

Usage with chronicle.New03

import (
    "github.com/xraph/chronicle"
    "github.com/xraph/chronicle/store"
    "github.com/xraph/chronicle/store/memory"
)

mem := memory.New()
adapter := store.NewAdapter(mem)

c, err := chronicle.New(chronicle.WithStore(adapter))

Usage with the Forge extension04

import "github.com/xraph/chronicle/extension"

mem := memory.New()
ext := extension.New(extension.WithStore(mem))

The extension calls store.NewAdapter internally — no need to do it yourself.

Interfaces implemented05

memory.Store satisfies at compile time:

  • audit.Store

  • stream.Store

  • verify.Store

  • erasure.Store

  • retention.Store

  • compliance.ReportStore

  • store.Store (composite)

Characteristics06

AspectDetail
Concurrencysync.RWMutex — reads concurrent, writes exclusive
MigrateNo-op
PingNo-op (always succeeds)
CloseNo-op
PersistenceNone — all data lost on process exit