Versions in this module Expand all Collapse all v0 v0.0.5 Feb 3, 2021 Changes in this version + var NilTracked = new(nilItem) + func BitHighestInt64(n int64) (pos int) + func NormalTo2N(n int64) int64 + type Cache struct + func New(config *Configuration) *Cache + func (c *Cache) Clear() + func (c *Cache) Delete(key string) bool + func (c *Cache) DeleteFunc(matches func(key string, item *Item) bool) int + func (c *Cache) DeletePrefix(prefix string) int + func (c *Cache) Fetch(key string, duration time.Duration, fetch func() (interface{}, error)) (*Item, error) + func (c *Cache) FetchNow(key string, now time.Time, duration time.Duration, ...) (*Item, error) + func (c *Cache) Get(key string) *Item + func (c *Cache) GetDropped() int + func (c *Cache) GetIncrVal(key string) (r int64) + func (c *Cache) GetItem(key string) *Item + func (c *Cache) GetItemWithNow(key string, now time.Time) (*Item, bool) + func (c *Cache) GetWithNow(key string, now time.Time) *Item + func (c *Cache) GetWithNowNoPromote(key string, now time.Time) (*Item, bool) + func (c *Cache) Incr(key string, n int64, duration time.Duration) int64 + func (c *Cache) IncrNow(key string, n int64, now time.Time, duration time.Duration) int64 + func (c *Cache) IncrNowPromote(key string, n int64, now time.Time, duration time.Duration) int64 + func (c *Cache) IncrPromote(key string, n int64, duration time.Duration) int64 + func (c *Cache) ItemCount() int + func (c *Cache) Promote(item *Item) + func (c *Cache) Replace(key string, value interface{}) bool + func (c *Cache) Set(key string, value interface{}, duration time.Duration) + func (c *Cache) SetMaxSize(size int64) + func (c *Cache) SetWithDeadline(key string, value interface{}, deadline time.Time) + func (c *Cache) Stop() + func (c *Cache) TrackingGet(key string) TrackedItem + func (c *Cache) TrackingSet(key string, value interface{}, duration time.Duration) TrackedItem + type CacheInt64 struct + func NewCacheInt64(config *ConfigurationInt64) *CacheInt64 + func (c *CacheInt64) Clear() + func (c *CacheInt64) Delete(key int64) bool + func (c *CacheInt64) DeleteFunc(matches func(key int64, item *ItemInt64) bool) int + func (c *CacheInt64) DeletePrefix(prefix int64) int + func (c *CacheInt64) Fetch(key int64, duration time.Duration, fetch func() (interface{}, error)) (*ItemInt64, error) + func (c *CacheInt64) FetchNow(key int64, now time.Time, duration time.Duration, ...) (*ItemInt64, error) + func (c *CacheInt64) Get(key int64) *ItemInt64 + func (c *CacheInt64) GetDropped() int + func (c *CacheInt64) GetIncrVal(key int64) (r int64) + func (c *CacheInt64) GetItem(key int64) *ItemInt64 + func (c *CacheInt64) GetItemWithNow(key int64, now time.Time) (*ItemInt64, bool) + func (c *CacheInt64) GetWithNow(key int64, now time.Time) *ItemInt64 + func (c *CacheInt64) GetWithNowNoPromote(key int64, now time.Time) (*ItemInt64, bool) + func (c *CacheInt64) Incr(key int64, n int64, duration time.Duration) int64 + func (c *CacheInt64) IncrNow(key int64, n int64, now time.Time, duration time.Duration) int64 + func (c *CacheInt64) IncrNowPromote(key int64, n int64, now time.Time, duration time.Duration) int64 + func (c *CacheInt64) IncrPromote(key int64, n int64, duration time.Duration) int64 + func (c *CacheInt64) ItemCount() int + func (c *CacheInt64) Promote(item *ItemInt64) + func (c *CacheInt64) Replace(key int64, value interface{}) bool + func (c *CacheInt64) Set(key int64, value interface{}, duration time.Duration) + func (c *CacheInt64) SetMaxSize(size int64) + func (c *CacheInt64) SetWithDeadline(key int64, value interface{}, deadline time.Time) + func (c *CacheInt64) Stop() + func (c *CacheInt64) TrackingGet(key int64) TrackedItem + func (c *CacheInt64) TrackingSet(key int64, value interface{}, duration time.Duration) TrackedItem + type Configuration struct + func Configure() *Configuration + func (c *Configuration) Buckets(count uint32) *Configuration + func (c *Configuration) DeleteBuffer(size uint32) *Configuration + func (c *Configuration) GetsPerPromote(count int32) *Configuration + func (c *Configuration) ItemsToPrune(count uint32) *Configuration + func (c *Configuration) MaxSize(max int64) *Configuration + func (c *Configuration) OnDelete(callback func(item *Item)) *Configuration + func (c *Configuration) PromoteBuffer(size uint32) *Configuration + func (c *Configuration) Track() *Configuration + type ConfigurationInt64 struct + func ConfigureInt64() *ConfigurationInt64 + func (c *ConfigurationInt64) Buckets(count uint32) *ConfigurationInt64 + func (c *ConfigurationInt64) DeleteBuffer(size uint32) *ConfigurationInt64 + func (c *ConfigurationInt64) GetsPerPromote(count int32) *ConfigurationInt64 + func (c *ConfigurationInt64) ItemsToPrune(count uint32) *ConfigurationInt64 + func (c *ConfigurationInt64) MaxSize(max int64) *ConfigurationInt64 + func (c *ConfigurationInt64) OnDelete(callback func(item *ItemInt64)) *ConfigurationInt64 + func (c *ConfigurationInt64) PromoteBuffer(size uint32) *ConfigurationInt64 + func (c *ConfigurationInt64) Track() *ConfigurationInt64 + type Item struct + func (i *Item) Expired() bool + func (i *Item) Expires() time.Time + func (i *Item) Extend(duration time.Duration) + func (i *Item) IsExpired(now time.Time) bool + func (i *Item) Key() string + func (i *Item) Release() + func (i *Item) TTL() time.Duration + func (i *Item) Value() interface{} + type ItemInt64 struct + func (i *ItemInt64) Expired() bool + func (i *ItemInt64) Expires() time.Time + func (i *ItemInt64) Extend(duration time.Duration) + func (i *ItemInt64) IsExpired(now time.Time) bool + func (i *ItemInt64) Key() int64 + func (i *ItemInt64) Release() + func (i *ItemInt64) TTL() time.Duration + func (i *ItemInt64) Value() interface{} + type LayeredCache struct + func Layered(config *Configuration) *LayeredCache + func (c *LayeredCache) Clear() + func (c *LayeredCache) Delete(primary, secondary string) bool + func (c *LayeredCache) DeleteAll(primary string) bool + func (c *LayeredCache) DeleteFunc(primary string, matches func(key string, item *Item) bool) int + func (c *LayeredCache) DeletePrefix(primary, prefix string) int + func (c *LayeredCache) Fetch(primary, secondary string, duration time.Duration, ...) (*Item, error) + func (c *LayeredCache) Get(primary, secondary string) *Item + func (c *LayeredCache) GetDropped() int + func (c *LayeredCache) GetOrCreateSecondaryCache(primary string) *SecondaryCache + func (c *LayeredCache) ItemCount() int + func (c *LayeredCache) Replace(primary, secondary string, value interface{}) bool + func (c *LayeredCache) Set(primary, secondary string, value interface{}, duration time.Duration) + func (c *LayeredCache) SetMaxSize(size int64) + func (c *LayeredCache) Stop() + func (c *LayeredCache) TrackingGet(primary, secondary string) TrackedItem + func (c *LayeredCache) TrackingSet(primary, secondary string, value interface{}, duration time.Duration) TrackedItem + type SecondaryCache struct + func (c *SecondaryCache) TrackingGet(secondary string) TrackedItem + func (s *SecondaryCache) Delete(secondary string) bool + func (s *SecondaryCache) Fetch(secondary string, duration time.Duration, fetch func() (interface{}, error)) (*Item, error) + func (s *SecondaryCache) Get(secondary string) *Item + func (s *SecondaryCache) Replace(secondary string, value interface{}) bool + func (s *SecondaryCache) Set(secondary string, value interface{}, duration time.Duration) *Item + type Sized interface + Size func() int64 + type TrackedItem interface + Expired func() bool + Expires func() time.Time + Extend func(duration time.Duration) + Release func() + TTL func() time.Duration + Value func() interface{}