Decorator for ensuring that tests (conditions/unless) only get run once; key should be set to a unique value per test.
This example configures a generic workflow which will always progress to “success” when next is called; note that there’s no need for caching because always and never are idempotent functions:
In this example we create a workflow that will succeed or fail based on the result of coinflip; here we use the @Workflow.cache decorator to preserve the results of coinflip, otherwise we would be resetting the value as each trigger is evaluated, leading to inconsistent results: