ScriptCache

scalus.cardano.ledger.ScriptCache
final class ScriptCache(maxEntries: Int)

Keeps Plutus scripts across transactions, so a script that many transactions carry or reference is hashed and decoded once.

A PlutusScript caches its hash and its decoded program itself, but every decoded transaction brings new script instances, so without a cache each evaluation hashes and decodes every script again. intern hands back the first instance seen with the same language and bytes, and with it the work already done on it. One cache can serve several evaluators, for example one per slot configuration.

The least recently used script is dropped when the cache is full. Safe to share between threads.

Value parameters

maxEntries

how many scripts to keep

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def intern(script: Script): Script

The cached instance of script, or script itself, now cached, if none is. Native scripts are returned as they are.

The cached instance of script, or script itself, now cached, if none is. Native scripts are returned as they are.

Attributes

def size: Int

How many scripts the cache holds.

How many scripts the cache holds.

Attributes