Documentation ¶
Index ¶
- type Cache
- func (c *Cache) AddItem(key string, value ...any) error
- func (c *Cache) Cap() int
- func (c *Cache) Clean()
- func (c *Cache) DeleteExpired()
- func (c *Cache) Get(key string) (any, bool)
- func (c *Cache) GetHash(key, subKey string) (any, bool)
- func (c *Cache) GetItem(key string) []any
- func (c *Cache) GetItemByIndex(key string, idx int) any
- func (c *Cache) Remove(key string)
- func (c *Cache) RemoveHash(key, subKey string) error
- func (c *Cache) RemoveItem(key string, idx int) error
- func (c *Cache) Set(key string, value any) error
- func (c *Cache) SetHash(key, subKey string, value any) error
- func (c *Cache) SetItem(key string, idx int, value any) error
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewWithCleanupInterval ¶
func NewWithExpiration ¶
func (*Cache) DeleteExpired ¶ added in v1.4.2
func (c *Cache) DeleteExpired()
func (*Cache) Get ¶ added in v1.4.2
Get an item from the cache.Returns the item or nil, and a bool indicating whether the key was found
func (*Cache) GetHash ¶ added in v1.4.2
GetHash get a hash value from the cache.Returns the hashes or nil, and a bool indicating whether the key was found
func (*Cache) GetItemByIndex ¶ added in v1.4.2
GetItemByIndex return a value of Type is T or nil
func (*Cache) RemoveHash ¶ added in v1.4.2
func (*Cache) RemoveItem ¶ added in v1.4.2
RemoveItem an item from the cache. Does nothing if the key is not in the cache.
func (*Cache) Set ¶ added in v1.4.2
Set Add an item to the cache,replacing any existing item. note key is primary key
Click to show internal directories.
Click to hide internal directories.