cache

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheEntry

type CacheEntry[T any] struct {
	Expirable
	// contains filtered or unexported fields
}

type Expirable

type Expirable interface {
	Expired() bool
}

type ExpirationTime

type ExpirationTime time.Time

func (ExpirationTime) Expired

func (e ExpirationTime) Expired() bool

type KeyedCache

type KeyedCache[T any] struct {
	// contains filtered or unexported fields
}

func NewKeyedCache

func NewKeyedCache[T any](ttl time.Duration) *KeyedCache[T]

func (*KeyedCache[T]) Clear

func (c *KeyedCache[T]) Clear()

func (*KeyedCache[T]) Delete

func (c *KeyedCache[T]) Delete(key string)

func (*KeyedCache[T]) GC

func (c *KeyedCache[T]) GC()

func (*KeyedCache[T]) Get

func (c *KeyedCache[T]) Get(key string) (T, bool)

func (*KeyedCache[T]) Set

func (c *KeyedCache[T]) Set(key string, value T)

func (*KeyedCache[T]) SetWithExpirable

func (c *KeyedCache[T]) SetWithExpirable(key string, value T, exp Expirable)

func (*KeyedCache[T]) SetWithTTL

func (c *KeyedCache[T]) SetWithTTL(key string, value T, ttl time.Duration)

func (*KeyedCache[T]) Take

func (c *KeyedCache[T]) Take(key string) (T, bool)

type TypedCache

type TypedCache[T any] struct {
	// contains filtered or unexported fields
}

func NewTypedCache

func NewTypedCache[T any](ttl time.Duration) *TypedCache[T]

func (*TypedCache[T]) Clear

func (c *TypedCache[T]) Clear()

func (*TypedCache[T]) DeleteKey

func (c *TypedCache[T]) DeleteKey(key string)

func (*TypedCache[T]) GC

func (c *TypedCache[T]) GC()

func (*TypedCache[T]) GetType

func (c *TypedCache[T]) GetType(key, typeKey string) (T, bool)

func (*TypedCache[T]) SetType

func (c *TypedCache[T]) SetType(key, typeKey string, value T)

func (*TypedCache[T]) SetTypeWithExpirable

func (c *TypedCache[T]) SetTypeWithExpirable(key, typeKey string, value T, exp Expirable)

func (*TypedCache[T]) SetTypeWithTTL

func (c *TypedCache[T]) SetTypeWithTTL(key, typeKey string, value T, ttl time.Duration)

Jump to

Keyboard shortcuts

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