Documentation ¶
Index ¶
Constants ¶
View Source
const CacheTypeArc = "arc"
View Source
const CacheTypeLru = "lru"
View Source
const CacheTypeSimple = "simple"
View Source
const CacheTypeTwoQueue = "2q"
View Source
const DefaultBucketSize = 32
View Source
const DefaultDecreaseRatio = 0.9
View Source
const DefaultSize = 10240
View Source
const HistorySize = 12
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketI ¶
type BucketI interface { Add(key string, value interface{}, ttl time.Duration) bool Get(key string) (data interface{}, found bool, canAdd bool) Remove(key string) }
func NewBucket ¶
func NewBucket(opts *CacheOptions) (BucketI, error)
func NewBucketLru ¶
func NewBucketLru(opts *CacheOptions) (BucketI, error)
func NewBucketLruArc ¶
func NewBucketLruArc(opts *CacheOptions) (BucketI, error)
func NewBucketLruTwoQueue ¶
func NewBucketLruTwoQueue(opts *CacheOptions) (BucketI, error)
func NewBucketSimple ¶
func NewBucketSimple(opts *CacheOptions) BucketI
type BucketLru ¶
type BucketLru struct { BucketI // contains filtered or unexported fields }
type BucketLruArc ¶
type BucketLruArc struct { BucketI // contains filtered or unexported fields }
func (*BucketLruArc) Add ¶
func (bucket *BucketLruArc) Add(key string, value interface{}, ttl time.Duration) bool
func (*BucketLruArc) Remove ¶
func (bucket *BucketLruArc) Remove(key string)
type BucketLruTwoQueue ¶
type BucketLruTwoQueue struct { BucketI // contains filtered or unexported fields }
func (*BucketLruTwoQueue) Add ¶
func (bucket *BucketLruTwoQueue) Add(key string, value interface{}, ttl time.Duration) bool
func (*BucketLruTwoQueue) Get ¶
func (bucket *BucketLruTwoQueue) Get(key string) (interface{}, bool, bool)
func (*BucketLruTwoQueue) Remove ¶
func (bucket *BucketLruTwoQueue) Remove(key string)
type BucketSimple ¶
type BucketSimple struct { BucketI // contains filtered or unexported fields }
func (*BucketSimple) Add ¶
func (bucket *BucketSimple) Add(key string, value interface{}, ttl time.Duration) bool
func (*BucketSimple) Remove ¶
func (bucket *BucketSimple) Remove(key string)
type CacheI ¶
type CacheI interface { Add(key string, value interface{}, ttl time.Duration) bool Get(key string) (data interface{}, found bool, canAdd bool) Remove(key string) }
func NewCache ¶
func NewCache(options *CacheOptions) (CacheI, error)
type CacheOptions ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.