memory

package
v0.0.1-rc5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package memory provides an in-process ScanStore backed by patrickmn/go-cache. This is the MVP default backend (single instance, TTL-based eviction).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a memory-backed ScanStore.

func New

func New(defaultTTL time.Duration) *Store

New returns a memory ScanStore with the given default TTL. Pass storage.TTL from config; callers may still override per-Put via the ttl argument to Put.

func (*Store) Delete

func (s *Store) Delete(_ context.Context, id string) error

func (*Store) Get

func (s *Store) Get(_ context.Context, id string) (*storage.Scan, error)

func (*Store) Put

func (s *Store) Put(_ context.Context, scan *storage.Scan, ttl time.Duration) error

Put inserts or replaces the scan. A ttl of 0 falls back to the default. The store keeps a private copy: callers may continue to mutate the supplied *Scan after Put returns without affecting the stored entry.

func (*Store) UpdateStatus

func (s *Store) UpdateStatus(_ context.Context, id string, fn func(*storage.Scan) error) error

UpdateStatus loads the scan, applies fn, and writes it back atomically. If fn returns an error the scan is not modified.

Jump to

Keyboard shortcuts

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