Skip to content

Caching

Below is a concise overview of how caching works in makeModule. The cache option determines when and how often a module is recomputed. It can be set to one of the following values:

cache = ‘run’ (default)

Each module is computed once per “run.” If you call the same module multiple times within one run, its value is reused. Upon a new run (or after certain resets), the module is computed again.

Caller

C ❲Cache❳

B

A

cache = ‘module’

The result is computed only once per module’s lifetime. Repeated calls to the same module within that lifetime return the same cached value.

makeModule Instance ❲Cache❳

Caller

C

B

A

cache = ‘none’

No caching at all. Each time you call a module, it runs the computation anew.

Use cache according to your application’s needs: • run (default) — Cache the result for each run. • module — Cache the result for the entire module lifetime. • none — Never cache; recompute on every call.