simplelru

package
v0.0.0-...-19bb427 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictCallback

type EvictCallback func(s *utils.Entry)

type LRU

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

func NewLRU

func NewLRU(size int, onEvict EvictCallback) (*LRU, error)

func (*LRU) Add

func (c *LRU) Add(s utils.Service) bool

Add adds a value to the cache. Returns true if an eviction occurred.

func (*LRU) Containkey

func (c *LRU) Containkey(key interface{}) (ok bool)

Check if a key is in the cache, without updating the recent-ness or deleting it for being stale.

func (*LRU) Contains

func (c *LRU) Contains(key interface{}, rt string) (ok bool)

func (*LRU) Get

func (c *LRU) Get(s utils.Service) ([]utils.Entry, error)

Get looks up a key's value from the cache.

func (*LRU) Keys

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

Keys returns a slice of the keys in the cache, from oldest to newest.

func (*LRU) Len

func (c *LRU) Len() int

Len returns the number of items in the cache.

func (*LRU) List

func (c *LRU) List() []utils.Service

List list all element from the cache

func (*LRU) Purge

func (c *LRU) Purge()

Purge is used to completely clear the cache

func (*LRU) Remove

func (c *LRU) Remove(s utils.Service) error

removeElement is used to remove a given list element from the cache

func (*LRU) RemoveOldest

func (c *LRU) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

func (*LRU) Set

func (c *LRU) Set(originalValue utils.Service, modifyValue utils.Service) error

type Record

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

type Records

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

Jump to

Keyboard shortcuts

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