cache

package
v2.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARCCache

type ARCCache struct {
	// contains filtered or unexported fields
}

func NewARCCache

func NewARCCache(size int, ttl time.Duration) *ARCCache

func (ARCCache) Del

func (l ARCCache) Del(key string)

func (ARCCache) Get

func (l ARCCache) Get(key string) ([]byte, bool)

func (ARCCache) Set

func (l ARCCache) Set(key string, data []byte)

type IStore

type IStore interface {
	Get(key interface{}) (value interface{}, ok bool)
	Add(key, value interface{})
	Remove(key interface{})
}

type Item

type Item struct {
	Key      string
	Value    interface{}
	ExpireAt time.Time
}

type LruCache

type LruCache struct {
	// contains filtered or unexported fields
}

func NewLruCache

func NewLruCache(size int, ttl time.Duration) *LruCache

func (LruCache) Del

func (l LruCache) Del(key string)

func (LruCache) Get

func (l LruCache) Get(key string) ([]byte, bool)

func (LruCache) Set

func (l LruCache) Set(key string, data []byte)

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

func (TwoQueueCache) Del

func (l TwoQueueCache) Del(key string)

func (TwoQueueCache) Get

func (l TwoQueueCache) Get(key string) ([]byte, bool)

func (TwoQueueCache) Set

func (l TwoQueueCache) Set(key string, data []byte)

type TwoQueueCacheOption

type TwoQueueCacheOption func(*TwoQueueCache)

func WithGhostRatio

func WithGhostRatio(ghostRatio float64) TwoQueueCacheOption

func WithRecentRatio

func WithRecentRatio(recentRatio float64) TwoQueueCacheOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL