Documentation ¶
Index ¶
- type Cache
- type Getter
- type Item
- type LFU
- type LRU
- type Opt
- type Storage
- type Store
- func (s Store[K, V]) Evict(key K)
- func (s Store[K, V]) EvictAll(keys []K)
- func (s Store[K, V]) Get(ctx context.Context, key K) (Item[V], bool, error)
- func (s Store[K, V]) NewItem(value V, ttl time.Duration) Item[V]
- func (s Store[K, V]) Put(key K, item Item[V])
- func (s Store[K, V]) Update(ctx context.Context, key K, args []byte, ...) (Item[V], error)
- type StoreOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T comparable, K any] struct { // contains filtered or unexported fields }
Cache is essentially a wrapper around map[T]K that support concurrent safety
func NewCache ¶
func NewCache[T comparable, K any]() *Cache[T, K]
type LFU ¶
type LFU[T comparable, K any] struct { // contains filtered or unexported fields }
LFU cache (least frequently used)
The zero value is not ready for use. Refer to NewLFU for the factory method.
type LRU ¶
type LRU[T comparable, K any] struct { // contains filtered or unexported fields }
LRU cache (least recently used)
The zero value is not ready for use. Refer to NewLRU for the factory method.
type Store ¶ added in v0.4.1
type Store[K comparable, V any] struct { // contains filtered or unexported fields }
func NewStore ¶ added in v0.4.1
func NewStore[K comparable, V any](opts ...StoreOpt[K, V]) *Store[K, V]
type StoreOpt ¶ added in v0.4.1
type StoreOpt[K comparable, V any] func(*Store[K, V])
func WithGetter ¶ added in v0.4.1
func WithGetter[K comparable, V any](getter Getter[K, V]) StoreOpt[K, V]
func WithStorage ¶ added in v0.4.1
func WithStorage[K comparable, V any](storage Storage[K, V]) StoreOpt[K, V]
Click to show internal directories.
Click to hide internal directories.