memory

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package memory is the memory implementation of the Trickster Cache and uses ristretto (TinyLFU admission-controlled cache) to manage cache objects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Name   string
	Config *options.Options
	// contains filtered or unexported fields
}

Cache defines a Memory Cache client that conforms to the Cache interface

func New

func New(name string, cfg *options.Options) *Cache

New returns a new memory cache as a Trickster Cache Interface type

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Connect

func (c *Cache) Connect() error

Connect initializes the Cache

func (*Cache) Remove

func (c *Cache) Remove(cacheKeys ...string) error

func (*Cache) Retrieve

func (c *Cache) Retrieve(cacheKey string) ([]byte, status.LookupStatus, error)

Retrieve looks for an object in cache and returns it (or an error if not found)

func (*Cache) RetrieveReference

func (c *Cache) RetrieveReference(cacheKey string) (any,
	status.LookupStatus, error,
)

RetrieveReference looks for an object in cache and returns it (or an error if not found)

func (*Cache) Store

func (c *Cache) Store(cacheKey string, data []byte, ttl time.Duration) error

Store places an object in the cache using the specified key and ttl

func (*Cache) StoreReference

func (c *Cache) StoreReference(cacheKey string, data cache.ReferenceObject, ttl time.Duration) error

StoreReference stores an object directly to the memory cache without requiring serialization

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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