cache

package
v0.0.0-...-1db1413 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 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 Cache

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

Cache store element with a expired time

func New

func New(interval time.Duration) *Cache

New return *Cache

func (Cache) Get

func (c Cache) Get(key interface{}) interface{}

Get element in Cache, and drop when it expired

func (Cache) Put

func (c Cache) Put(key interface{}, payload interface{}, ttl time.Duration)

Put element in Cache with its ttl

func (Cache) Range

func (c Cache) Range(callback func(key, value interface{}))

func (Cache) Size

func (c Cache) Size() int

type LRU

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

func NewLruCache

func NewLruCache(interval time.Duration) *LRU

New return *Cache

func (LRU) Clean

func (l LRU) Clean()

func (LRU) Delete

func (l LRU) Delete(key interface{})

func (LRU) First

func (l LRU) First() interface{}

func (LRU) Get

func (l LRU) Get(key interface{}) interface{}

func (LRU) IsExist

func (l LRU) IsExist(key interface{}) bool

func (LRU) Len

func (l LRU) Len() int

func (LRU) Put

func (l LRU) Put(key interface{}, payload interface{})

Jump to

Keyboard shortcuts

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