@ethereumjs/statemanager / CodeCache
Defined in: cache/code.ts:20
In-memory contract code cache with checkpoint/revert support.
Cachenew CodeCache(
opts):CodeCache
Defined in: cache/code.ts:35
CodeCache
Cache.constructor
_checkpoints:
number=0
Defined in: cache/cache.ts:10
Cache._checkpoints
_debug:
Debugger
Defined in: cache/cache.ts:8
Cache._debug
_diffCache:
Map<string,CodeCacheElement|undefined>[] =[]
Defined in: cache/code.ts:33
Diff cache collecting the state of the cache at the beginning of checkpoint height (respectively: before a first modification)
If the whole cache element is undefined (in contrast to the code), the element didn’t exist in the cache before.
_lruCache:
LRUCache<string,CodeCacheElement,unknown> |undefined
Defined in: cache/code.ts:21
_orderedMapCache:
OrderedMap<string,CodeCacheElement> |undefined
Defined in: cache/code.ts:22
_stats:
object
Defined in: cache/cache.ts:12
deletions:
number=0
hits:
number=0
reads:
number=0
size:
number=0
writes:
number=0
Cache._stats
_saveCachePreState(
cacheKeyHex):void
Defined in: cache/code.ts:55
Saves the state of the code cache before making changes to it.
string
Account key for which code is being modified.
void
checkpoint():
void
Defined in: cache/code.ts:224
Marks the current state of the cache as a checkpoint, which can later be reverted or committed.
void
clear():
void
Defined in: cache/code.ts:265
Clears the cache.
void
commit():
void
Defined in: cache/code.ts:204
Commits the current state of the cache (no effect on trie).
void
del(
address):void
Defined in: cache/code.ts:123
Marks code as deleted in the cache.
Account address for which code is being fetched.
void
flush(): [
string,CodeCacheElement][]
Defined in: cache/code.ts:147
Flushes the cache by returning codes that have been modified or deleted and resetting the diff cache (at checkpoint height).
[string, CodeCacheElement][]
get(
address):CodeCacheElement|undefined
Defined in: cache/code.ts:98
Returns the queried code or undefined if it doesn’t exist.
Account address for which code is being fetched.
CodeCacheElement | undefined
put(
address,code):void
Defined in: cache/code.ts:74
Puts code into the cache under its hash.
Address of account code is being modified for.
Uint8Array<ArrayBufferLike> | undefined
Bytecode or undefined if code doesn’t exist.
void
revert():
void
Defined in: cache/code.ts:176
Revert changes to the cache to the last checkpoint (no effect on trie).
void
size():
number
Defined in: cache/code.ts:233
Current number of cached code entries.
number
stats(
reset?):any
Defined in: cache/code.ts:247
Returns a dictionary with cache statistics.
boolean = true
Whether to reset statistics after retrieval.
any
A dictionary with cache statistics.