Documentation
¶
Index ¶
- Variables
- type Cache
- func (c *Cache) Delete(key string)
- func (c *Cache) Get(key string) (interface{}, bool)
- func (c *Cache) Has(key string) bool
- func (c *Cache) Set(key string, item *Item) error
- func (c *Cache) UpdateExpiresAt(key string, expiresAt time.Time) error
- func (c *Cache) UpdateValue(key string, value interface{}) error
- type Item
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrItemHasExpired = errors.New("item has expired")
)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents an in-memory cache
func (*Cache) UpdateExpiresAt ¶ added in v0.1.1
UpdateExpiresAt updates the expiration time of an item in the cache
func (*Cache) UpdateValue ¶ added in v0.1.1
UpdateValue updates the value of an item in the cache
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents a cached value with an expiration time
func (*Item) GetExpiresAt ¶ added in v0.1.1
GetExpiresAt returns the expiration time of the cached value
func (*Item) GetValue ¶ added in v0.1.1
func (i *Item) GetValue() interface{}
GetValue returns the cached value
func (*Item) HasExpired ¶ added in v0.1.1
HasExpired returns true if the cached value has expired
func (*Item) SetExpiresAt ¶ added in v0.1.1
SetExpiresAt sets the expiration time of the cached value
Click to show internal directories.
Click to hide internal directories.