Documentation ¶
Index ¶
- type Cache
- func (cache *Cache) Clear()
- func (cache *Cache) Del(key string) error
- func (cache *Cache) DelMulti(keys []string)
- func (cache *Cache) Get(key string) (value interface{}, ok bool)
- func (cache *Cache) GetDel(key string) (value interface{}, ok bool)
- func (cache *Cache) GetMulti(keys []string) map[string]interface{}
- func (cache *Cache) GetSet(key string, ttl time.Duration, getValue func(key string) (interface{}, error)) (interface{}, error)
- func (cache *Cache) GetSetMulti(keys []string, ttl time.Duration, ...) map[string]interface{}
- func (cache *Cache) Has(key string) bool
- func (cache *Cache) Keys() []string
- func (cache *Cache) Len() int
- func (cache *Cache) Set(key string, value interface{}, ttl time.Duration) error
- func (cache *Cache) SetMulti(values map[string]interface{}, ttl time.Duration)
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
}
Cache lru cache
func (*Cache) GetSet ¶
func (cache *Cache) GetSet(key string, ttl time.Duration, getValue func(key string) (interface{}, error)) (interface{}, error)
GetSet looks up a key's value from the cache. if does not exist add to the cache
func (*Cache) GetSetMulti ¶
func (cache *Cache) GetSetMulti(keys []string, ttl time.Duration, getValue func(key string) (interface{}, error)) map[string]interface{}
GetSetMulti mulit get values, if does not exist add to the cache
Click to show internal directories.
Click to hide internal directories.