Documentation ¶
Index ¶
- Constants
- type ICache
- type InMemoryCache
- func (c *InMemoryCache) Delete(key string) error
- func (c *InMemoryCache) Get(key string) (any, error)
- func (c *InMemoryCache) Init(_ any) error
- func (c *InMemoryCache) Set(key string, item any) error
- func (c *InMemoryCache) SetWithCustomExpiration(key string, item any, expiration time.Duration) error
Constants ¶
View Source
const CacheMissError = "not found"
CacheMissError is the generic error text for a cache miss
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICache ¶
type ICache interface { Init(interface{}) error Get(string) (interface{}, error) Set(string, interface{}) error SetWithCustomExpiration(string, interface{}, time.Duration) error Delete(string) error }
ICache is an interface for a pluggable cache
type InMemoryCache ¶
InMemoryCache is a cache running in memory, not shared between any nodes
func (*InMemoryCache) Delete ¶
func (c *InMemoryCache) Delete(key string) error
Delete removes a key If the key is not present, this is a no-op
func (*InMemoryCache) Get ¶
func (c *InMemoryCache) Get(key string) (any, error)
Get retrieves an item by key
func (*InMemoryCache) Init ¶
func (c *InMemoryCache) Init(_ any) error
Init initializes the in memory cache
func (*InMemoryCache) Set ¶
func (c *InMemoryCache) Set(key string, item any) error
Set adds or updates a key
func (*InMemoryCache) SetWithCustomExpiration ¶
func (c *InMemoryCache) SetWithCustomExpiration(key string, item any, expiration time.Duration) error
SetWithCustomExpiration adds or updates a key with an expiration time other than the default
Click to show internal directories.
Click to hide internal directories.