Documentation
¶
Index ¶
- Constants
- Variables
- func MakeMaxResolutionChan(maxresolution time.Duration) chan Timeable
- type Cache
- func (self *Cache) Custom(onExpiration ExpirationHandler, ttl time.Duration, ...) CacheTtl
- func (self *Cache) Simple(ttl time.Duration, maxresolution time.Duration) CacheTtl
- func (self *Cache) WithExpirationHandler(onExpiration ExpirationHandler, ttl time.Duration, maxresolution time.Duration) CacheTtl
- type CacheTtl
- type CacheTtlFactory
- type ExpirationHandler
- type Item
- type MP
- type SimpleTime
- type SliceCacheTTL
- type Timeable
Constants ¶
View Source
const DEFAULT_EXPIRATION_CHAN_SIZE = 10000
View Source
const DEFAULT_SLICE_SIZE = 20
Variables ¶
View Source
var Factory = &Cache{}
Functions ¶
func MakeMaxResolutionChan ¶
Types ¶
type Cache ¶
type Cache struct{}
func (*Cache) WithExpirationHandler ¶
type CacheTtl ¶
type CacheTtl interface {
Append(key interface{}, value Timeable) error
Get(key interface{}) (ret []Timeable, ok bool)
ExpireAll() int // Returns number of expired items
}
func WithExpirationHandler ¶
type CacheTtlFactory ¶
type CacheTtlFactory interface {
WithExpirationHandler(onExpiration ExpirationHandler, ttl time.Duration, maxresolution time.Duration) CacheTtl
Simple(ttl time.Duration, maxresolution time.Duration) CacheTtl
Custom(onExpiration ExpirationHandler,
ttl time.Duration,
expirationResolution chan Timeable,
defaultSliceSize int,
expirationChanSize int) CacheTtl
}
type ExpirationHandler ¶
type ExpirationHandler func(key interface{}, arr []Timeable)
type SimpleTime ¶
func (*SimpleTime) GetTS ¶
func (self *SimpleTime) GetTS() time.Time
type SliceCacheTTL ¶
type SliceCacheTTL struct {
// contains filtered or unexported fields
}
func (*SliceCacheTTL) Append ¶
func (self *SliceCacheTTL) Append(key interface{}, value Timeable) error
func (*SliceCacheTTL) ExpireAll ¶
func (self *SliceCacheTTL) ExpireAll() int
func (*SliceCacheTTL) Get ¶
func (self *SliceCacheTTL) Get(key interface{}) (ret []Timeable, ok bool)
Click to show internal directories.
Click to hide internal directories.