lru

package
v0.0.0-...-9109040 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(size int) cache.Cache

Creates a LRU cache size is the maximum size of the cache, -1 if it is unlimited

Types

type LRUCache

type LRUCache struct {
	Cache *lru.Cache
}

func (*LRUCache) Clear

func (c *LRUCache) Clear()

func (*LRUCache) ContainsKey

func (c *LRUCache) ContainsKey(key interface{}) bool

func (*LRUCache) Get

func (c *LRUCache) Get(key interface{}) interface{}

func (*LRUCache) KeySet

func (c *LRUCache) KeySet() []interface{}

func (*LRUCache) Put

func (c *LRUCache) Put(key, value interface{})

Put value in cache, it doesn't have guarantee of concurrency treat

func (*LRUCache) PutIfAbsent

func (c *LRUCache) PutIfAbsent(key, value interface{}) interface{}

Check if value is already associated, if yes just return it, if not put the passed value and return nil This method must be thread safe (atomic)

func (*LRUCache) Remove

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

func (*LRUCache) Size

func (c *LRUCache) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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