lru

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 AddOption

type AddOption[K, V any] func(*lruEntry[K, V])

func WithTimeout added in v0.3.7

func WithTimeout[K, V any](t time.Duration) AddOption[K, V]

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]) Add added in v0.3.6

func (l *SyncLru[K, V]) Add(key K, value V, opts ...AddOption[K, V])

func (*SyncLru[K, V]) ClearExpired added in v0.3.7

func (l *SyncLru[K, V]) ClearExpired()

func (*SyncLru[K, V]) Delete added in v0.3.6

func (l *SyncLru[K, V]) Delete(key K)

func (*SyncLru[K, V]) Len added in v0.3.7

func (l *SyncLru[K, V]) Len() int

func (*SyncLru[K, V]) Load added in v0.3.6

func (l *SyncLru[K, V]) Load(key K) (v V, ok bool)

func (*SyncLru[K, V]) LoadOptimistically added in v0.3.7

func (l *SyncLru[K, V]) LoadOptimistically(key K) (v V, expired, ok bool)

func (*SyncLru[K, V]) LoadRefreshExpire added in v0.3.6

func (l *SyncLru[K, V]) LoadRefreshExpire(key K) (v V, ok bool)

func (*SyncLru[K, V]) Range added in v0.3.6

func (l *SyncLru[K, V]) Range(ranger func(K, V))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL