Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentLRU ¶
type ConcurrentLRU[K comparable, V any] struct { sync.Mutex // contains filtered or unexported fields }
ConcurrentLRU is a lru.LRU with a lock. It is concurrent safe.
func NewConecurrentLRU ¶ added in v4.1.7
func NewConecurrentLRU[K comparable, V any](maxSize int, onEvict func(key K, v V)) *ConcurrentLRU[K, V]
func (*ConcurrentLRU[K, V]) Add ¶
func (c *ConcurrentLRU[K, V]) Add(key K, v V)
func (*ConcurrentLRU[K, V]) Clean ¶
func (c *ConcurrentLRU[K, V]) Clean(f func(key K, v V) (remove bool)) (removed int)
func (*ConcurrentLRU[K, V]) Del ¶
func (c *ConcurrentLRU[K, V]) Del(key K)
func (*ConcurrentLRU[K, V]) Get ¶
func (c *ConcurrentLRU[K, V]) Get(key K) (v V, ok bool)
func (*ConcurrentLRU[K, V]) Len ¶
func (c *ConcurrentLRU[K, V]) Len() int
type ShardedLRU ¶ added in v4.1.7
type ShardedLRU[V any] struct { // contains filtered or unexported fields }
func NewShardedLRU ¶ added in v4.1.7
func NewShardedLRU[V any]( shardNum, maxSizePerShard int, onEvict func(key string, v V), ) *ShardedLRU[V]
func (*ShardedLRU[V]) Add ¶ added in v4.1.7
func (c *ShardedLRU[V]) Add(key string, v V)
func (*ShardedLRU[V]) Clean ¶ added in v4.1.7
func (c *ShardedLRU[V]) Clean(f func(key string, v V) (remove bool)) (removed int)
func (*ShardedLRU[V]) Del ¶ added in v4.1.7
func (c *ShardedLRU[V]) Del(key string)
func (*ShardedLRU[V]) Get ¶ added in v4.1.7
func (c *ShardedLRU[V]) Get(key string) (v V, ok bool)
func (*ShardedLRU[V]) Len ¶ added in v4.1.7
func (c *ShardedLRU[V]) Len() int
Click to show internal directories.
Click to hide internal directories.