memory

package
v1.99.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package memory is an in-process dict driver backed by a sync.Map.

Intended use: unit tests and short-lived dev runs of the standalone binary where persistence is not required. State is lost on process exit. NOT suitable for production: gives no durability guarantees, no cross-process visibility (use file/redis/sql for that).

Configuration: no settings — instantiating with Driver:"memory" is enough. TTL is honoured at lookup/iterate time (lazy expiration); ExpireScan walks the map and purges anything past its deadline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(_ dict.Config) (dict.Dict, error)

New constructs a memory dict. The Config is ignored — there is nothing to configure for an in-process map.

Types

type Dict

type Dict struct {
	// contains filtered or unexported fields
}

Dict is the memory driver. All methods are goroutine-safe.

func (*Dict) Begin

func (d *Dict) Begin(ctx context.Context, set *dict.OpSettings) (dict.Tx, error)

func (*Dict) Close

func (d *Dict) Close() error

func (*Dict) ExpireScan

func (d *Dict) ExpireScan(ctx context.Context) error

func (*Dict) Iterate

func (d *Dict) Iterate(ctx context.Context, _ *dict.OpSettings, path string, flags dict.IterFlag) (dict.Iterator, error)

func (*Dict) Lookup

func (d *Dict) Lookup(ctx context.Context, _ *dict.OpSettings, key string) ([][]byte, bool, error)

func (*Dict) Name

func (d *Dict) Name() string

func (*Dict) Wait

func (d *Dict) Wait(_ context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL