lru

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: GPL-3.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWasmCacheSize = 1024

	DefaultWasmCacheDir = "wasmcache"
)

Functions

This section is empty.

Types

type WasmLDBCache

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

func NewWasmCache

func NewWasmCache(size int) (*WasmLDBCache, error)

func NewWasmLDBCache

func NewWasmLDBCache(size int) (*WasmLDBCache, error)

func WasmCache

func WasmCache() *WasmLDBCache

func (*WasmLDBCache) Add

func (w *WasmLDBCache) Add(key common.Address, value *WasmModule) bool

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

func (*WasmLDBCache) Contains

func (w *WasmLDBCache) Contains(key common.Address) bool

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

func (*WasmLDBCache) ContainsOrAdd

func (w *WasmLDBCache) ContainsOrAdd(key common.Address, value *WasmModule) (ok, evict bool)

ContainsOrAdd checks if a key is in the cache without updating the recent-ness or deleting it for being stale, and if not, adds the value. Returns whether found and whether an eviction occurred.

func (*WasmLDBCache) Get

func (w *WasmLDBCache) Get(key common.Address) (*WasmModule, bool)

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

func (*WasmLDBCache) Keys

func (w *WasmLDBCache) Keys() []interface{}

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

func (*WasmLDBCache) Len

func (w *WasmLDBCache) Len() int

Len returns the number of items in the cache.

func (*WasmLDBCache) Peek

func (w *WasmLDBCache) Peek(key common.Address) (*WasmModule, bool)

Returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.

func (*WasmLDBCache) Purge

func (w *WasmLDBCache) Purge()

Purge is used to completely clear the cache

func (*WasmLDBCache) Remove

func (w *WasmLDBCache) Remove(key common.Address)

Remove removes the provided key from the cache.

func (*WasmLDBCache) RemoveOldest

func (w *WasmLDBCache) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

type WasmModule

type WasmModule struct {
	Module *exec.CompiledModule
}

Jump to

Keyboard shortcuts

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