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] interface { Set(key K, val V) Get(key K) (V, bool) Delete(del func(key K, val V) bool) }
Cache is a very broad cache interface to support an array of underlying implementations.
type CopyOnWriteCache ¶
type CopyOnWriteCache[K comparable, V any] struct { // contains filtered or unexported fields }
CopyOnWriteCache is an implementation of Cache interface.
func NewCopyOnWriteCache ¶
func NewCopyOnWriteCache[K comparable, V any]() *CopyOnWriteCache[K, V]
NewCopyOnWriteCache returns a cache implementation interface of Cache interface.
func (*CopyOnWriteCache[K, V]) Delete ¶
func (c *CopyOnWriteCache[K, V]) Delete(del func(key K, val V) bool)
Delete items from cache.
func (*CopyOnWriteCache[K, V]) Get ¶
func (c *CopyOnWriteCache[K, V]) Get(key K) (V, bool)
Get value from cache.
func (*CopyOnWriteCache[K, V]) Set ¶
func (c *CopyOnWriteCache[K, V]) Set(key K, val V)
Set item to cache.
type ExpiryCache ¶
type ExpiryCache[V any] struct { Cache[string, ExpiryCacheValue[V]] }
ExpiryCache is an implementation of Cache interface with cache expiration built in.
func NewExpiryCache ¶
NewExpiryCache creates a Cache interface implementation with cleaning (expiration) routine.
type ExpiryCacheValue ¶
ExpiryCacheValue is cache value for expiry cache. Exp represents unix timestamp in seconds.
Click to show internal directories.
Click to hide internal directories.