Documentation
¶
Index ¶
- type Dict
- func (d *Dict) All() (all map[string]interface{})
- func (d *Dict) CheckAll()
- func (d *Dict) Del(k string) (ok bool)
- func (d *Dict) DelExpired(k string) (ok bool)
- func (d *Dict) ExpireAt(k string, t time.Time) (has bool)
- func (d *Dict) ExpireDur(k string, dur time.Duration) (has bool)
- func (d *Dict) Get(k string) (val interface{}, has bool)
- func (d *Dict) GetDel(k string) (val interface{}, has bool)
- func (d *Dict) GetSet(k string, v interface{}, opts ...ItemOption) (val interface{}, has bool)
- func (d *Dict) GetSetX(k string, v interface{}, opts ...ItemOption) (val interface{}, has bool)
- func (d *Dict) Handle(k string, h ExpiredHandler) (has bool)
- func (d *Dict) Has(k string) (has bool)
- func (d *Dict) Len() (cnt int)
- func (d *Dict) Set(k string, v interface{}, opts ...ItemOption) (ok bool)
- func (d *Dict) SetX(k string, v interface{}, opts ...ItemOption) (has bool)
- func (d *Dict) TTL(k string) (dur time.Duration)
- type DictOption
- type ExpiredHandler
- type ItemOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict 字典
func (*Dict) GetSet ¶
func (d *Dict) GetSet(k string, v interface{}, opts ...ItemOption) (val interface{}, has bool)
GetSet 获取key对应的value并设置新值
func (*Dict) GetSetX ¶
func (d *Dict) GetSetX(k string, v interface{}, opts ...ItemOption) (val interface{}, has bool)
GetSetX 获取key对应的value并设置新值,如果key不存在则设置新值
func (*Dict) Handle ¶
func (d *Dict) Handle(k string, h ExpiredHandler) (has bool)
Handle 设置key的过期处理器
func (*Dict) Set ¶
func (d *Dict) Set(k string, v interface{}, opts ...ItemOption) (ok bool)
Set 设置key-value
type DictOption ¶
type DictOption func(*Dict)
DictOption 词典选项
func DictCheckInterval ¶
func DictCheckInterval(dur time.Duration) DictOption
DictCheckInterval 设置检查间隔
func DictExpireHandler ¶
func DictExpireHandler(h ExpiredHandler) DictOption
DictExpireHandler 设置过期处理器
type ExpiredHandler ¶
type ExpiredHandler func(k string, v interface{})
Click to show internal directories.
Click to hide internal directories.