Documentation
¶
Index ¶
- Constants
- type Cache
- func (c *Cache[K, V]) Close()
- func (c *Cache[K, V]) Delete(key K)
- func (c *Cache[K, V]) Get(key K) (V, bool)
- func (c *Cache[K, V]) GetItem(key K) (Item[V], bool)
- func (c *Cache[K, V]) GetKeys() []K
- func (c *Cache[K, V]) GetOrSet(key K, value V, duration time.Duration) (V, bool)
- func (c *Cache[K, V]) GetOrSetItem(key K, value V, duration time.Duration) (Item[V], bool)
- func (c *Cache[K, V]) Set(key K, value V, duration time.Duration) bool
- func (c *Cache[K, V]) SetItem(key K, value V, duration time.Duration) Item[V]
- type DeallocationFunc
- type DeallocationReason
- type Item
- type Options
Constants ¶
View Source
const ( ReasonTimedOut = DeallocationReason(iota) ReasonDeleted = DeallocationReason(iota) )
View Source
const DefaultTTL time.Duration = time.Nanosecond * 1
View Source
const NoTTL time.Duration = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
func (*Cache[K, V]) GetOrSetItem ¶
type DeallocationFunc ¶
type DeallocationFunc[K comparable, V any] func(key K, value V, reason DeallocationReason)
type DeallocationReason ¶
type DeallocationReason int
type Item ¶
type Item[V any] struct { // contains filtered or unexported fields }
func (*Item[V]) GetDuration ¶
type Options ¶
type Options[K comparable, V any] struct { // contains filtered or unexported fields }
func (Options[K, V]) DisableUpdateTime ¶
func (Options[K, V]) SetDeallocationFunc ¶
func (o Options[K, V]) SetDeallocationFunc(f DeallocationFunc[K, V]) Options[K, V]
func (Options[K, V]) SetDefaultTTL ¶
Click to show internal directories.
Click to hide internal directories.