cache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

type LRUExpireCache

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

func NewLRUExpireCache

func NewLRUExpireCache(maxSize int) *LRUExpireCache

NewLRUExpireCache return Lru cache

func NewLRUExpireCacheWithClock

func NewLRUExpireCacheWithClock(maxSize int, clock Clock) *LRUExpireCache

NewLRUExpireCacheWithClock

func (*LRUExpireCache) Add

func (c *LRUExpireCache) Add(key interface{}, value interface{}, ttl time.Duration)

add new element

func (*LRUExpireCache) Get

func (c *LRUExpireCache) Get(key interface{}) (interface{}, bool)

get unexpired element from lru cache

func (*LRUExpireCache) Keys

func (c *LRUExpireCache) Keys() []interface{}

get all keys

func (*LRUExpireCache) Remove

func (c *LRUExpireCache) Remove(key interface{})

remove element

Jump to

Keyboard shortcuts

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