iotex-core: Index | Files

package cache

import ""


Package Files


type ThreadSafeLruCache Uses

type ThreadSafeLruCache struct {
    // contains filtered or unexported fields

ThreadSafeLruCache defines a lru cache which is thread safe

func NewThreadSafeLruCache Uses

func NewThreadSafeLruCache(maxEntries int) *ThreadSafeLruCache

NewThreadSafeLruCache returns a thread safe lru cache with fix size

func (*ThreadSafeLruCache) Add Uses

func (c *ThreadSafeLruCache) Add(key lru.Key, value interface{})

Add adds a value to the cache.

func (*ThreadSafeLruCache) Clear Uses

func (c *ThreadSafeLruCache) Clear()

Clear purges all stored items from the cache.

func (*ThreadSafeLruCache) Get Uses

func (c *ThreadSafeLruCache) Get(key lru.Key) (value interface{}, ok bool)

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

func (*ThreadSafeLruCache) Len Uses

func (c *ThreadSafeLruCache) Len() int

Len returns the number of items in the cache.

func (*ThreadSafeLruCache) Remove Uses

func (c *ThreadSafeLruCache) Remove(key lru.Key)

Remove removes the provided key from the cache.

func (*ThreadSafeLruCache) RemoveOldest Uses

func (c *ThreadSafeLruCache) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

Package cache imports 2 packages (graph) and is imported by 2 packages. Updated 2019-07-29. Refresh now. Tools for package owners.