Help us shape the future of Go! Take the 2026 Go Developer Survey

memstore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init initializes the default store once.

func StartDefaultGC

func StartDefaultGC(interval time.Duration)

StartDefaultGC starts a background goroutine that periodically calls CleanupExpired() on the default SharedStore. It runs once per process.

Types

type SharedStore

type SharedStore interface {
	Set(ns, key string, val []byte, ttl time.Duration) error
	Get(ns, key string) ([]byte, bool, error)
	Delete(ns, key string) error
	Keys(ns string) ([]string, error)
	CleanupExpired() error
}

SharedStore is a simple namespaced key-value store with TTL support.

func Get

func Get() SharedStore

Get returns the initialized default SharedStore.

func NewFileStore

func NewFileStore(root string) SharedStore

NewFileStore creates a directory-backed SharedStore.

func NewMemoryStore

func NewMemoryStore() SharedStore

NewMemoryStore creates an in-memory SharedStore.

Jump to

Keyboard shortcuts

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