Documentation ¶
Index ¶
- type Entry
- type SyncCache
- func (sc *SyncCache[K, V]) Clear()
- func (sc *SyncCache[K, V]) Close()
- func (sc *SyncCache[K, V]) CompareAndDelete(key K, oldEntry *Entry[V]) (success bool)
- func (sc *SyncCache[K, V]) CompareValueAndDelete(key K, oldValue V) (success bool)
- func (sc *SyncCache[K, V]) Delete(key K)
- func (sc *SyncCache[K, V]) Load(key K) (value *Entry[V], loaded bool)
- func (sc *SyncCache[K, V]) LoadAndDelete(key K) (value *Entry[V], loaded bool)
- func (sc *SyncCache[K, V]) LoadOrStore(key K, value V, expire time.Duration) (actual *Entry[V], loaded bool)
- func (sc *SyncCache[K, V]) Range(f func(key K, value *Entry[V]) bool)
- func (sc *SyncCache[K, V]) Start()
- func (sc *SyncCache[K, V]) Store(key K, value V, expire time.Duration)
- type SyncCacheConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry[V any] struct { // contains filtered or unexported fields }
func (*Entry[V]) AddExpiration ¶
func (*Entry[V]) SetExpiration ¶
type SyncCache ¶
type SyncCache[K comparable, V any] struct { // contains filtered or unexported fields }
func NewSyncCache ¶
func NewSyncCache[K comparable, V any](trimTime time.Duration, conf ...SyncCacheConfig[K, V]) *SyncCache[K, V]
func (*SyncCache[K, V]) CompareAndDelete ¶
func (*SyncCache[K, V]) CompareValueAndDelete ¶
func (*SyncCache[K, V]) LoadAndDelete ¶
func (*SyncCache[K, V]) LoadOrStore ¶
type SyncCacheConfig ¶
type SyncCacheConfig[K comparable, V any] func(sc *SyncCache[K, V])
func WithDeletedCallback ¶
func WithDeletedCallback[K comparable, V any](callback func(v V)) SyncCacheConfig[K, V]
Click to show internal directories.
Click to hide internal directories.