syncmap

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter is an unbounded L1 cache backed by sync.Map.

This is the default L1 adapter used when no custom adapter is configured. It offers excellent performance under read-heavy workloads but provides no eviction, no size limits, and no cost awareness.

For production services with memory constraints, consider a bounded adapter backed by Ristretto, Theine, or Otter.

func New

func New() *Adapter

New returns a new sync.Map-backed L1 adapter.

func (*Adapter) Clear

func (a *Adapter) Clear()

func (*Adapter) Close

func (a *Adapter) Close() error

func (*Adapter) CompareAndSwap

func (a *Adapter) CompareAndSwap(key string, old, new any) bool

func (*Adapter) Delete

func (a *Adapter) Delete(key string)

func (*Adapter) Get

func (a *Adapter) Get(key string) (any, bool)

func (*Adapter) LoadAndDelete

func (a *Adapter) LoadAndDelete(key string) (any, bool)

func (*Adapter) Range

func (a *Adapter) Range(fn func(key string, value any) bool)

func (*Adapter) Set

func (a *Adapter) Set(key string, value any, cost int64)

Jump to

Keyboard shortcuts

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