Chronicle

Redis Store

High-throughput Redis store for latency-sensitive Chronicle workloads.

The store/redis package implements Chronicle's store.Store interface using Grove KV backed by the Redis driver. All entities are stored as JSON via Grove KV, making it suitable for high-throughput, low-latency audit and event logging.

Import

import (
    "github.com/xraph/grove/kv"
    "github.com/xraph/grove/kv/drivers/redisdriver"
    "github.com/xraph/chronicle/store/redis"
)

Constructor

kvStore, err := kv.Open(redisdriver.Open("redis://localhost:6379/0"))
if err != nil {
    log.Fatal(err)
}

s := redis.New(kvStore)

Migrations

if err := s.Migrate(ctx); err != nil {
    log.Fatal(err)
}

Migrate is a no-op for Redis (schemaless). It is safe to call on every startup for consistency with other backends.

Full setup with chronicle.New

import (
    "context"
    "log"

    "github.com/xraph/grove/kv"
    "github.com/xraph/grove/kv/drivers/redisdriver"
    "github.com/xraph/chronicle"
    "github.com/xraph/chronicle/store"
    chronicleredis "github.com/xraph/chronicle/store/redis"
)

ctx := context.Background()

kvStore, err := kv.Open(redisdriver.Open("redis://localhost:6379/0"))
if err != nil {
    log.Fatal(err)
}

s := chronicleredis.New(kvStore)

adapter := store.NewAdapter(s)

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

With the Forge extension

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

ext := extension.New(extension.WithStore(s))
app.Register(ext)

Interfaces implemented

redis.Store satisfies:

  • audit.Store
  • stream.Store
  • verify.Store
  • erasure.Store
  • retention.Store
  • compliance.ReportStore
  • store.Store (composite)

Characteristics

AspectDetail
DriverGrove KV + redisdriver
MigrationsNo-op (schemaless)
Pingkv.Ping(ctx)
CloseNo-op -- caller owns the *kv.Store lifecycle

When to use

  • High-throughput, low-latency event and audit logging.
  • Ephemeral workloads where persistence is not critical.
  • Environments already running Redis for caching or pub/sub.

On this page