memory

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package memory provides an in-memory storage backend.

This is the default storage backend, suitable for development and testing. Data is not persisted across restarts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage implements storage.Storage with in-memory maps.

func New

func New() *Storage

New creates a new in-memory storage.

func (*Storage) Close

func (s *Storage) Close() error

Close releases storage resources.

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, key string) error

Delete removes a key.

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, key string) ([]byte, error)

Get retrieves a value by key.

func (*Storage) Len

func (s *Storage) Len() int

Len returns the number of entries (for testing).

func (*Storage) Set

func (s *Storage) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

Set stores a value with an optional TTL.

Jump to

Keyboard shortcuts

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