Documentation ¶
Index ¶
- Variables
- func HashKey(key []byte) uint64
- type Cache
- func (this *Cache) Count() (count int)
- func (this *Cache) Delete(key string)
- func (this *Cache) Destroy()
- func (this *Cache) GC()
- func (this *Cache) IncreaseInt64(key string, delta int64, expiredAt int64) int64
- func (this *Cache) Read(key string) (item *Item)
- func (this *Cache) Write(key string, value interface{}, expiredAt int64)
- type Item
- type MaxItemsOption
- type OptionInterface
- type Piece
- func (this *Piece) Add(key uint64, item *Item)
- func (this *Piece) Count() (count int)
- func (this *Piece) Delete(key uint64)
- func (this *Piece) Destroy()
- func (this *Piece) GC()
- func (this *Piece) IncreaseInt64(key uint64, delta int64, expiredAt int64) (result int64)
- func (this *Piece) Read(key uint64) (item *Item)
- type PiecesOption
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCache = NewCache()
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
TTL缓存 最大的缓存时间为30 * 86400 Piece数据结构:
Piece1 | Piece2 | Piece3 | ... [ Item1, Item2, ... | ...
KeyMap列表数据结构 { timestamp1 => [key1, key2, ...] }, ...
func NewCache ¶
func NewCache(opt ...OptionInterface) *Cache
func (*Cache) IncreaseInt64 ¶
type MaxItemsOption ¶
type MaxItemsOption struct {
Count int
}
func NewMaxItemsOption ¶
func NewMaxItemsOption(count int) *MaxItemsOption
type OptionInterface ¶
type OptionInterface interface { }
type Piece ¶
type Piece struct {
// contains filtered or unexported fields
}
func (*Piece) IncreaseInt64 ¶
type PiecesOption ¶
type PiecesOption struct {
Count int
}
func NewPiecesOption ¶
func NewPiecesOption(count int) *PiecesOption
Click to show internal directories.
Click to hide internal directories.