Documentation ¶
Index ¶
- Variables
- type WasmLDBCache
- func (w *WasmLDBCache) Add(key common.Address, value *WasmModule) bool
- func (w *WasmLDBCache) Contains(key common.Address) bool
- func (w *WasmLDBCache) ContainsOrAdd(key common.Address, value *WasmModule) (ok, evict bool)
- func (w *WasmLDBCache) Get(key common.Address) (*WasmModule, bool)
- func (w *WasmLDBCache) Keys() []interface{}
- func (w *WasmLDBCache) Len() int
- func (w *WasmLDBCache) Peek(key common.Address) (*WasmModule, bool)
- func (w *WasmLDBCache) Purge()
- func (w *WasmLDBCache) Remove(key common.Address)
- func (w *WasmLDBCache) RemoveOldest()
- type WasmModule
Constants ¶
This section is empty.
Variables ¶
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
}