Documentation ¶
Index ¶
- Constants
- type CacheItem
- type InMemoryCache
- func (c *InMemoryCache) Clear() error
- func (c *InMemoryCache) Connect() error
- func (c *InMemoryCache) Delete(key string) error
- func (c *InMemoryCache) Get(key string, dst any) (client.Item, error)
- func (c *InMemoryCache) Has(key string) (bool, error)
- func (c *InMemoryCache) Keys() ([]string, error)
- func (c *InMemoryCache) Set(key string, value any, ttl time.Duration) error
Constants ¶
View Source
const ( ShortExpiration = time.Second * 10 MedExpiration = time.Second * 60 LongExpiration = time.Hour DefaultExpiration = MedExpiration )
View Source
const ( ErrNotFound cacheError = iota ErrInvalidKey ErrInvalidValue )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryCache ¶
type InMemoryCache struct {
// contains filtered or unexported fields
}
func NewInMemoryCache ¶
func NewInMemoryCache(cleanInterval time.Duration) *InMemoryCache
func (*InMemoryCache) Delete ¶
func (c *InMemoryCache) Delete(key string) error
Delete an item from the cache.
func (*InMemoryCache) Has ¶
func (c *InMemoryCache) Has(key string) (bool, error)
Check if the cache has an item.
func (*InMemoryCache) Keys ¶
func (c *InMemoryCache) Keys() ([]string, error)
Keys returns all keys in the cache.
Click to show internal directories.
Click to hide internal directories.