OrchidStratum is a deterministic, content-addressable caching layer for the
Orchid workflow engine.
It intercepts step execution via OrchidStratum.BypassHook and routes results
through a two-tier storage system:
- Meta Store (
OrchidStratum.MetaStorage) — records a lightweightMetaItemper step execution, indexed by a hash of the step's identity and its inputs. - Blob Store (
OrchidStratum.BlobStorage) — stores the actual heavy payloads, keyed by their content hash, and replaces them in the workflow graph with cheap{:ref, store, hash}tuples (dehydration).
On a subsequent run with identical inputs the hook resolves the cached
MetaItem, verifies that every referenced blob is still present, and returns
the stored outputs — without executing the step at all.
Summary
Functions
Attaches caching to every step in an Orchid.Recipe or list of Orchid steps.
Functions
@spec apply_cache( [Orchid.Step.t()] | Orchid.Recipe.t(), {module(), term()}, {module(), term()}, keyword() ) :: {[Orchid.Step.t()] | Orchid.Recipe.t(), keyword()}
Attaches caching to every step in an Orchid.Recipe or list of Orchid steps.
This is the high-level entry point. It delegates to the list-based
apply_cache/4 and merges the required baggage and hook into orchid_opts.
Returns {updated_recipe, updated_orchid_opts} ready to be passed directly
to Orchid.run/3.
Arguments
recipe_or_steps— an%Orchid.Recipe{}struct or orchid steps.meta_conf— a{module, store_ref}tuple for the Meta Store adapter.blob_conf— a{module, store_ref}tuple for the Blob Store adapter.old_orchid_opts— the existing keyword options forOrchid.run/3. Pre-existing baggage keys and hooks are preserved.
Example
{recipe_or_steps, opts} =
OrchidStratum.apply_cache(recipe_or_steps, meta_conf, blob_conf, [baggage: %{foo: :bar}])
Orchid.run(recipe_or_steps, inputs, opts)