golazy.dev golazy.dev / lazycache / inmemorycache Index | Files

package inmemorycache

import "golazy.dev/lazycache/inmemorycache"

Package inmemorycache provides the default in-process lazycache backend.

lazyapp uses this package when an application does not configure another cache backend. Direct use is appropriate for tests, single-process apps, or custom lazycache setup that wants the same LRU implementation.

Functions

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}
func (c *Cache) Entries

Entries returns a stable snapshot of stored entries.

func (c *Cache) Entries() []lazycache.EntryInfo
func (c *Cache) Entry

Entry returns a development-friendly snapshot of one cached value.

func (c *Cache) Entry(key string) (lazycache.EntryDetail, error)
func (c *Cache) Get

Get returns a value by key.

func (c *Cache) Get(key string) (any, error)
func (c *Cache) Keys

Keys returns a stable snapshot of stored keys.

func (c *Cache) Keys() []string
func (c *Cache) Set

Set stores value by key.

func (c *Cache) Set(key string, value any) error
func (c *Cache) Stats

Stats returns a point-in-time statistics snapshot.

func (c *Cache) Stats() lazycache.Stats