Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { sync.Mutex // contains filtered or unexported fields }
func (*Cache[K, V]) Get ¶
func (that *Cache[K, V]) Get(key K) StorageEntry[V]
type Fetcher ¶
type Fetcher[K comparable, V any] interface { Fetch(key K) (*V, error) }
type HotStorage ¶
type HotStorage[K comparable, V any] struct { // contains filtered or unexported fields }
func NewHotStorage ¶
func NewHotStorage[K comparable, V any]( capacity int, ) *HotStorage[K, V]
func (*HotStorage[K, V]) Cleanup ¶
func (that *HotStorage[K, V]) Cleanup() []K
func (*HotStorage[K, V]) Clear ¶
func (that *HotStorage[K, V]) Clear()
func (*HotStorage[K, V]) Get ¶
func (that *HotStorage[K, V]) Get(key K) (*V, bool)
func (*HotStorage[K, V]) Len ¶
func (that *HotStorage[K, V]) Len() int
func (*HotStorage[K, V]) Set ¶
func (that *HotStorage[K, V]) Set(key K, val *V)
type Provider ¶
type Provider[K comparable, V any] struct { // contains filtered or unexported fields }
func NewProvider ¶
func NewProvider[K comparable, V any]( fetcher Fetcher[K, V], storage ProviderStorage[K, V], ) *Provider[K, V]
type ProviderStorage ¶
type ProviderStorage[K comparable, V any] interface { Get(key K) StorageEntry[V] }
type Storage ¶
type Storage[K comparable, V any] interface { Set(key K, val *V) Get(key K) (*V, bool) Clear() Cleanup() []K Len() int }
type StorageEntry ¶
type TTLStorage ¶
type TTLStorage[K comparable, V any] struct { // contains filtered or unexported fields }
func NewTTLStorage ¶
func NewTTLStorage[K comparable, V any]( ttl time.Duration, ) *TTLStorage[K, V]
func (*TTLStorage[K, V]) Cleanup ¶
func (that *TTLStorage[K, V]) Cleanup() []K
func (*TTLStorage[K, V]) Clear ¶
func (that *TTLStorage[K, V]) Clear()
func (*TTLStorage[K, V]) Get ¶
func (that *TTLStorage[K, V]) Get(key K) (*V, bool)
func (*TTLStorage[K, V]) Len ¶
func (that *TTLStorage[K, V]) Len() int
func (*TTLStorage[K, V]) Set ¶
func (that *TTLStorage[K, V]) Set(key K, val *V)
type UnlimitedStorage ¶
type UnlimitedStorage[K comparable, V any] struct { // contains filtered or unexported fields }
func NewUnlimitedStorage ¶
func NewUnlimitedStorage[K comparable, V any]() *UnlimitedStorage[K, V]
func (*UnlimitedStorage[K, V]) Cleanup ¶
func (that *UnlimitedStorage[K, V]) Cleanup() []K
func (*UnlimitedStorage[K, V]) Clear ¶
func (that *UnlimitedStorage[K, V]) Clear()
func (*UnlimitedStorage[K, V]) Get ¶
func (that *UnlimitedStorage[K, V]) Get(key K) (*V, bool)
func (*UnlimitedStorage[K, V]) Len ¶
func (that *UnlimitedStorage[K, V]) Len() int
func (*UnlimitedStorage[K, V]) Set ¶
func (that *UnlimitedStorage[K, V]) Set(key K, val *V)
Click to show internal directories.
Click to hide internal directories.