Documentation ¶
Index ¶
- type EvictCallback
- type LruCache
- func (c *LruCache[K, V]) Clear()
- func (c *LruCache[K, V]) CloneTo(n *LruCache[K, V])
- func (c *LruCache[K, V]) Delete(key K)
- func (c *LruCache[K, V]) Exist(key K) bool
- func (c *LruCache[K, V]) Load(key K) (V, bool)
- func (c *LruCache[K, V]) LoadOrStore(key K, constructor func() V) (V, bool)
- func (c *LruCache[K, V]) LoadOrStoreWithAge(key K, maxAge int64, constructor func() V) (V, bool)
- func (c *LruCache[K, V]) LoadWithExpire(key K) (V, time.Time, bool)
- func (c *LruCache[K, V]) Range(block func(key K, value V))
- func (c *LruCache[K, V]) Store(key K, value V)
- func (c *LruCache[K, V]) StoreWithExpire(key K, value V, expires time.Time)
- type Option
- func WithAge[K comparable, V any](maxAge int64) Option[K, V]
- func WithEvict[K comparable, V any](cb EvictCallback[K, V]) Option[K, V]
- func WithSize[K comparable, V any](maxSize int) Option[K, V]
- func WithStale[K comparable, V any](stale bool) Option[K, V]
- func WithUpdateAgeOnGet[K comparable, V any]() Option[K, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictCallback ¶
type EvictCallback[K comparable, V any] func(key K, value V)
type LruCache ¶
type LruCache[K comparable, V any] struct { // contains filtered or unexported fields }
func (*LruCache[K, V]) Delete ¶
func (c *LruCache[K, V]) Delete(key K)
Delete removes the value associated with a key.
func (*LruCache[K, V]) LoadOrStore ¶
func (*LruCache[K, V]) LoadOrStoreWithAge ¶
func (*LruCache[K, V]) LoadWithExpire ¶
func (*LruCache[K, V]) StoreWithExpire ¶
type Option ¶
type Option[K comparable, V any] func(*LruCache[K, V])
func WithEvict ¶
func WithEvict[K comparable, V any](cb EvictCallback[K, V]) Option[K, V]
func WithUpdateAgeOnGet ¶
func WithUpdateAgeOnGet[K comparable, V any]() Option[K, V]
Click to show internal directories.
Click to hide internal directories.