cache

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key string, value interface{}, timeToLive ...time.Duration) (err error)
	Get(key string) (value interface{}, err error)
	Delete(key string) (err error)
	Purge() (err error)
	DeleteExpired(timeInterval time.Duration)
	Info() (info map[string]interface{}, err error)
}

func New

func New(capacity uint64, evictionPolicy EvictionPolicy, defaultTtl time.Duration) (cache Cache, err error)

type EvictionPolicy

type EvictionPolicy string
const (
	LRU EvictionPolicy = "LRU"
	LFU EvictionPolicy = "LFU"
)

func (*EvictionPolicy) Set

func (ep *EvictionPolicy) Set(value string) error

func (*EvictionPolicy) String

func (ep *EvictionPolicy) String() string

type FrequencyListItem

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

type LFUCache

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

func (*LFUCache) Delete

func (c *LFUCache) Delete(key string) (err error)

func (*LFUCache) DeleteExpired

func (c *LFUCache) DeleteExpired(timeInterval time.Duration)

func (*LFUCache) Get

func (c *LFUCache) Get(key string) (value interface{}, err error)

func (*LFUCache) Info

func (c *LFUCache) Info() (info map[string]interface{}, err error)

func (*LFUCache) Purge

func (c *LFUCache) Purge() (err error)

func (*LFUCache) Set

func (c *LFUCache) Set(key string, value interface{}, timeToLive ...time.Duration) (err error)

type LFUCacheItem

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

type LRUCache

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

func (*LRUCache) Delete

func (c *LRUCache) Delete(key string) (err error)

func (*LRUCache) DeleteExpired

func (c *LRUCache) DeleteExpired(timeInterval time.Duration)

func (*LRUCache) Get

func (c *LRUCache) Get(key string) (value interface{}, err error)

func (*LRUCache) Info

func (c *LRUCache) Info() (info map[string]interface{}, err error)

func (*LRUCache) Purge

func (c *LRUCache) Purge() (err error)

func (*LRUCache) Set

func (c *LRUCache) Set(key string, value interface{}, timeToLive ...time.Duration) (err error)

Jump to

Keyboard shortcuts

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