Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CacheStoreRistretto TODO // There is a bug for CacheStoreRistretto, do not use it. // Use CacheStoreGoCache or CacheStoreRedis or both. CacheStoreRistretto = "ristretto" CacheStoreGoCache = "go-cache" CacheStoreRedis = "redis" )
Variables ¶
View Source
var CacheManager gocache.CacheInterface[any]
Functions ¶
func NewCacheManager ¶ added in v2.2.0
func NewCacheManager(conf config.Config) gocache.CacheInterface[any]
Types ¶
type IStore ¶
type IStore interface { Get(key interface{}) (value interface{}, ok bool) Add(key, value interface{}) Remove(key interface{}) }
type LruCacheAdapter ¶
type LruCacheAdapter struct {
// contains filtered or unexported fields
}
func (*LruCacheAdapter) Add ¶
func (l *LruCacheAdapter) Add(key, value interface{})
func (*LruCacheAdapter) Get ¶
func (l *LruCacheAdapter) Get(key interface{}) (value interface{}, ok bool)
func (*LruCacheAdapter) Remove ¶
func (l *LruCacheAdapter) Remove(key interface{})
type TwoQueueCache ¶
type TwoQueueCache struct {
// contains filtered or unexported fields
}
func NewTwoQueueCache ¶
func NewTwoQueueCache(size int, ttl time.Duration, options ...TwoQueueCacheOption) *TwoQueueCache
type TwoQueueCacheOption ¶
type TwoQueueCacheOption func(*TwoQueueCache)
func WithGhostRatio ¶
func WithGhostRatio(ghostRatio float64) TwoQueueCacheOption
func WithRecentRatio ¶
func WithRecentRatio(recentRatio float64) TwoQueueCacheOption
Click to show internal directories.
Click to hide internal directories.