cache

package
v0.0.0-...-d5ce8da Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheHashKeyString

func CacheHashKeyString(key string) uint32

Types

type Cache

type Cache[V any] interface {
	GetName() string
	Add(key string, value V) error
	AddWithLifetime(key string, value V, lifetime time.Duration) error
	Get(key string, value *V) bool
	Remove(key string)
}

func NewCache

func NewCache[V any](conf *CacheConfig) Cache[V]

type CacheConfig

type CacheConfig struct {
	Lifetime time.Duration
	Name     string
}

type LRUCache

type LRUCache[V any] struct {
	// contains filtered or unexported fields
}

func (*LRUCache[V]) Add

func (cache *LRUCache[V]) Add(key string, value V) error

func (*LRUCache[V]) AddWithLifetime

func (cache *LRUCache[V]) AddWithLifetime(key string, value V, lifetime time.Duration) error

func (*LRUCache[V]) Get

func (cache *LRUCache[V]) Get(key string, value *V) bool

func (*LRUCache[V]) GetName

func (cache *LRUCache[V]) GetName() string

func (*LRUCache[V]) Remove

func (cache *LRUCache[V]) Remove(key string)

type RedisCache

type RedisCache[V any] struct {
	// contains filtered or unexported fields
}

func (*RedisCache[V]) Add

func (cache *RedisCache[V]) Add(key string, value V) error

func (*RedisCache[V]) AddWithLifetime

func (cache *RedisCache[V]) AddWithLifetime(key string, value V, lifetime time.Duration) error

func (*RedisCache[V]) Get

func (cache *RedisCache[V]) Get(key string, value *V) bool

func (*RedisCache[V]) GetName

func (cache *RedisCache[V]) GetName() string

func (*RedisCache[V]) Remove

func (cache *RedisCache[V]) Remove(key string)

Jump to

Keyboard shortcuts

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