Documentation
¶
Index ¶
- type CacheEntry
- type Expirable
- type ExpirationTime
- type KeyedCache
- func (c *KeyedCache[T]) Clear()
- func (c *KeyedCache[T]) Delete(key string)
- func (c *KeyedCache[T]) GC()
- func (c *KeyedCache[T]) Get(key string) (T, bool)
- func (c *KeyedCache[T]) Pop(key string) (T, bool)
- func (c *KeyedCache[T]) Set(key string, value T)
- func (c *KeyedCache[T]) SetWithExpirable(key string, value T, exp Expirable)
- func (c *KeyedCache[T]) SetWithTTL(key string, value T, ttl time.Duration)
- type TypedCache
- func (c *TypedCache[T]) Clear()
- func (c *TypedCache[T]) DeleteKey(key string)
- func (c *TypedCache[T]) GC()
- func (c *TypedCache[T]) GetType(key, typeKey string) (T, bool)
- func (c *TypedCache[T]) SetType(key, typeKey string, value T)
- func (c *TypedCache[T]) SetTypeWithExpirable(key, typeKey string, value T, exp Expirable)
- func (c *TypedCache[T]) SetTypeWithTTL(key, typeKey string, value T, ttl time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheEntry ¶
type ExpirationTime ¶
func (ExpirationTime) Expired ¶
func (e ExpirationTime) Expired() bool
type KeyedCache ¶
type KeyedCache[T any] struct { // contains filtered or unexported fields }
func NewKeyedCache ¶
func NewKeyedCache[T any](ttl time.Duration) *KeyedCache[T]
func (*KeyedCache[T]) Clear ¶
func (c *KeyedCache[T]) Clear()
func (*KeyedCache[T]) Delete ¶
func (c *KeyedCache[T]) Delete(key string)
func (*KeyedCache[T]) GC ¶
func (c *KeyedCache[T]) GC()
func (*KeyedCache[T]) Get ¶
func (c *KeyedCache[T]) Get(key string) (T, bool)
func (*KeyedCache[T]) Pop ¶ added in v4.1.9
func (c *KeyedCache[T]) Pop(key string) (T, bool)
func (*KeyedCache[T]) Set ¶
func (c *KeyedCache[T]) Set(key string, value T)
func (*KeyedCache[T]) SetWithExpirable ¶
func (c *KeyedCache[T]) SetWithExpirable(key string, value T, exp Expirable)
func (*KeyedCache[T]) SetWithTTL ¶
func (c *KeyedCache[T]) SetWithTTL(key string, value T, ttl time.Duration)
type TypedCache ¶
type TypedCache[T any] struct { // contains filtered or unexported fields }
func NewTypedCache ¶
func NewTypedCache[T any](ttl time.Duration) *TypedCache[T]
func (*TypedCache[T]) Clear ¶
func (c *TypedCache[T]) Clear()
func (*TypedCache[T]) DeleteKey ¶
func (c *TypedCache[T]) DeleteKey(key string)
func (*TypedCache[T]) GC ¶
func (c *TypedCache[T]) GC()
func (*TypedCache[T]) GetType ¶
func (c *TypedCache[T]) GetType(key, typeKey string) (T, bool)
func (*TypedCache[T]) SetType ¶
func (c *TypedCache[T]) SetType(key, typeKey string, value T)
func (*TypedCache[T]) SetTypeWithExpirable ¶
func (c *TypedCache[T]) SetTypeWithExpirable(key, typeKey string, value T, exp Expirable)
func (*TypedCache[T]) SetTypeWithTTL ¶
func (c *TypedCache[T]) SetTypeWithTTL(key, typeKey string, value T, ttl time.Duration)
Click to show internal directories.
Click to hide internal directories.