lru

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 3 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 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 AddOption

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

func WithExpireTime added in v0.3.6

func WithExpireTime[K, V any](t time.Time) AddOption[K, V]

type Option

type Option[K comparable, V any] func(*lru[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 ...Option[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]) Load added in v0.3.6

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

func (*ReverseSyncLru[K, V]) LoadExpireTime added in v0.3.6

func (l *ReverseSyncLru[K, V]) LoadExpireTime(key K) (v V, expireTime time.Time, 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]) Delete added in v0.3.6

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

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

func (l *SyncLru[K, V]) LoadExpireTime(key K) (v V, expireTime time.Time, 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