Dispatch

Memory Store

In-memory store for development, testing, and prototyping.

The memory store keeps all data in Go maps protected by a sync.RWMutex. It requires zero configuration and is the default store for unit tests.

When to use

  • Unit tests -- Fast, deterministic, no external dependencies.
  • Local development -- Get started without setting up a database.
  • Prototyping -- Validate business logic before choosing a persistence layer.

Data is lost when the process exits.

Usage

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

s := memory.New()

r, err := relay.New(relay.WithStore(s))

Internals

AspectDetail
Concurrencysync.RWMutex -- reads run concurrently, writes are exclusive
IndexingMap keys by ID string; linear scan for list/filter
MigrateNo-op
PingNo-op (always succeeds)
CloseNo-op

Limitations

  • No persistence -- all data lost on restart.
  • List operations are O(n) scans.
  • Single process only.
  • No multi-operation transactions.

On this page