Documentation ¶
Index ¶
- func WithCapacity[K comparable, V any](capacity uint) func(*lru[K, V])
- func WithDefaultTimeout[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 Option
- type ReverseOption
- type ReverseSyncLru
- func (l *ReverseSyncLru[K, V]) Add(key K, value V, opts ...AddOption[K, V])
- func (l *ReverseSyncLru[K, V]) ClearExpired()
- func (l *ReverseSyncLru[K, V]) Delete(key K)
- func (l *ReverseSyncLru[K, V]) LastPopValue() (v V, _ bool)
- func (l *ReverseSyncLru[K, V]) Len() int
- func (l *ReverseSyncLru[K, V]) Load(key K) (v V, ok bool)
- func (l *ReverseSyncLru[K, V]) LoadOptimistic(key K) (v V, expired, ok bool)
- func (l *ReverseSyncLru[K, V]) LoadRefreshExpire(key K) (v V, ok bool)
- func (l *ReverseSyncLru[K, V]) Range(ranger func(K, V))
- func (l *ReverseSyncLru[K, V]) ReverseLoad(v V) (k K, ok bool)
- func (l *ReverseSyncLru[K, V]) ValueExist(key V) bool
- type SyncLru
- func (l *SyncLru[K, V]) Add(key K, value V, opts ...AddOption[K, V])
- func (l *SyncLru[K, V]) ClearExpired()
- func (l *SyncLru[K, V]) Delete(key K)
- func (l *SyncLru[K, V]) Len() int
- func (l *SyncLru[K, V]) Load(key K) (v V, ok bool)
- func (l *SyncLru[K, V]) LoadOptimistically(key K) (v V, expired, ok bool)
- func (l *SyncLru[K, V]) LoadRefreshExpire(key K) (v V, ok bool)
- func (l *SyncLru[K, V]) Range(ranger func(K, V))
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 WithDefaultTimeout ¶ added in v0.3.7
func WithDefaultTimeout[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 Option ¶
type Option[K comparable, V any] func(*lru[K, V])
type ReverseOption ¶ added in v0.3.7
type ReverseOption[K, V comparable] func(*ReverseSyncLru[K, V])
func WithLruOptions ¶ added in v0.3.7
func WithLruOptions[K, V comparable](options ...Option[K, V]) ReverseOption[K, V]
func WithOnValueChanged ¶ added in v0.3.7
func WithOnValueChanged[K, V comparable](f func(old, new V)) ReverseOption[K, V]
type ReverseSyncLru ¶ added in v0.3.6
type ReverseSyncLru[K, V comparable] struct { // contains filtered or unexported fields }
func NewSyncReverseLru ¶ added in v0.3.6
func NewSyncReverseLru[K, V comparable](options ...ReverseOption[K, V]) *ReverseSyncLru[K, V]
func (*ReverseSyncLru[K, V]) Add ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) Add(key K, value V, opts ...AddOption[K, V])
func (*ReverseSyncLru[K, V]) ClearExpired ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) ClearExpired()
func (*ReverseSyncLru[K, V]) Delete ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) Delete(key K)
func (*ReverseSyncLru[K, V]) LastPopValue ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) LastPopValue() (v V, _ bool)
func (*ReverseSyncLru[K, V]) Len ¶ added in v0.3.7
func (l *ReverseSyncLru[K, V]) Len() int
func (*ReverseSyncLru[K, V]) Load ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) Load(key K) (v V, ok bool)
func (*ReverseSyncLru[K, V]) LoadOptimistic ¶ added in v0.3.7
func (l *ReverseSyncLru[K, V]) LoadOptimistic(key K) (v V, expired, ok bool)
func (*ReverseSyncLru[K, V]) LoadRefreshExpire ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) LoadRefreshExpire(key K) (v V, ok bool)
func (*ReverseSyncLru[K, V]) Range ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) Range(ranger func(K, V))
func (*ReverseSyncLru[K, V]) ReverseLoad ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) ReverseLoad(v V) (k K, ok bool)
func (*ReverseSyncLru[K, V]) ValueExist ¶ added in v0.3.6
func (l *ReverseSyncLru[K, V]) ValueExist(key V) bool
type SyncLru ¶ added in v0.3.6
type SyncLru[K comparable, V any] struct { // contains filtered or unexported fields }
func NewSyncLru ¶ added in v0.3.6
func NewSyncLru[K comparable, V any](options ...Option[K, V]) *SyncLru[K, V]
func (*SyncLru[K, V]) ClearExpired ¶ added in v0.3.7
func (l *SyncLru[K, V]) ClearExpired()
func (*SyncLru[K, V]) LoadOptimistically ¶ added in v0.3.7
func (*SyncLru[K, V]) LoadRefreshExpire ¶ added in v0.3.6
Click to show internal directories.
Click to hide internal directories.