cache

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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