paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.
https://paritytech.github.io/txwrapper-core/
Apache License 2.0
77 stars 28 forks source link

fix: adjust memoization and cache #298

Closed TarikGul closed 1 year ago

TarikGul commented 1 year ago

createMetadata specific env vars.

Summary: createMetadata memoizes the call to ensure metadata is not reallocated in memory if it is the same call.

Methods that actively use createMetadata and are affected are:

NOTE: getRegistryBase uses createMetadataUnmemoized

TXWRAPPER_METADATA_CACHE_MAX

Summary: Set the max amount of memoized calls we want in the cache. It uses an LRU cache to handle the input and output of values. This takes in an integer. Ex: export TXWRAPPER_METADATA_CACHE_MAX=10. This will default to unlimited size if the value is not inputted.

NOTES:

TXWRAPPER_METADATA_CACHE_MAX_AGE

Summary: Set the TTL (Time To Live) for items in the memoized cache. This takes in an integer in the measurement of milliseconds. Ex: export TXWRAPPER_METADATA_CACHE_MAX_AGE=1000 for 1 second.

Other Changes