memory

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is an in-memory cache implementation.

func NewCache

func NewCache(config *cachev1.MemoryConfig) *Cache

NewCache creates a new instance of Cache with the given configuration.

func (*Cache) Clear

func (c *Cache) Clear(ctx context.Context) error

Clear clears the cache.

func (*Cache) Close

func (c *Cache) Close(ctx context.Context) error

Close closes the cache.

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) error

Delete deletes the value associated with the given key.

func (*Cache) Exists

func (c *Cache) Exists(ctx context.Context, key string) (bool, error)

Exists checks if a value exists for the given key.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) (string, error)

Get retrieves the value associated with the given key.

func (*Cache) GetAndDelete

func (c *Cache) GetAndDelete(ctx context.Context, key string) (string, error)

GetAndDelete retrieves the value associated with the given key and deletes it.

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value string, exp ...time.Duration) error

Set sets the value for the given key.

type CacheItem

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

CacheItem represents an item stored in the cache.

Jump to

Keyboard shortcuts

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