Documentation ¶
Index ¶
- func WithCapacity[K comparable, V any](capacity uint) func(*LRU[K, V])
- func WithExpireTimeout[K comparable, V any](t time.Duration) func(*LRU[K, V])
- func WithOnRemove[K comparable, V any](f func(K, V)) func(*LRU[K, V])
- type AddOption
- type LRU
- func (l *LRU[K, V]) Add(key K, value V, opts ...AddOption)
- func (l *LRU[K, V]) Delete(key K)
- func (l *LRU[K, V]) LastPopValue() (v V, _ bool)
- func (l *LRU[K, V]) Load(key K) (v V, ok bool)
- func (l *LRU[K, V]) LoadExpireTime(key K) (v V, expireTime time.Time, ok bool)
- func (l *LRU[K, V]) Range(ranger func(K, V))
- func (l *LRU[K, V]) ReverseLoad(v V) (k K, ok bool)
- func (l *LRU[K, V]) ValueExist(key V) bool
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCapacity ¶
func WithCapacity[K comparable, V any](capacity uint) func(*LRU[K, V])
func WithExpireTimeout ¶
func WithExpireTimeout[K comparable, V any](t time.Duration) func(*LRU[K, V])
func WithOnRemove ¶
func WithOnRemove[K comparable, V any](f func(K, V)) func(*LRU[K, V])
Types ¶
type LRU ¶
type LRU[K comparable, V any] struct { // contains filtered or unexported fields }
LRU Least Recently Used
func New ¶ added in v0.3.5
func New[K comparable, V any](options ...Option[K, V]) *LRU[K, V]
New create new lru cache
func (*LRU[K, V]) LastPopValue ¶
func (*LRU[K, V]) LoadExpireTime ¶
func (*LRU[K, V]) ReverseLoad ¶
func (*LRU[K, V]) ValueExist ¶
type Option ¶
type Option[K comparable, V any] func(*LRU[K, V])
Click to show internal directories.
Click to hide internal directories.