Skip to main content

Crate gear_wasmtime_cache

Crate gear_wasmtime_cache 

Source
Expand description

Wasmtime module cache.

The cache uses a per-code “single flight” protocol. The first thread that misses the LRU for a code hash records that hash in compiling, drops the lock, and compiles the module. Threads requesting the same hash wait on a condition variable, while threads requesting other hashes can reserve their own compile slots and proceed independently.

A CompilePermit represents ownership of one in-progress compile. Dropping it always removes the hash from compiling and wakes waiters, so both successful compilation and early errors unblock the next thread.

Functions§

get
Returns a compiled Wasmtime module, using an in-memory LRU cache on hits.