Caching is used to cache the results of a script, flow, flow step or app inline scripts for a specified number of seconds, thereby reducing the need for redundant computations when re-running the same step with identical input.
When you configure caching, Windmill stores the result in a cache for the duration you specify. If the same runnable is re-triggered with the same input within this duration, Windmill instantly retrieves the cached result instead of re-computing it.
This feature can significantly improve the performance of your scripts & flows, especially for steps that are computationally demanding or dependent on external resources, such as APIs or databases.
Caching a flow means caching the results of that script for a certain duration. If the flow is triggered with the same flow inputs during the given duration, it will return the cached result.
You can enable caching for a flow directly in the flow settings. Here's how you can do it:
- Settings: From the Flow Editor, go to the "Settings" menu and pick the
- Enable Caching: To enable caching, toggle on "Cache the results for each possible inputs" and specify the desired duration for caching results (in seconds.)
In the above example, the result of step the flow will be cached for 60 seconds. If
u/henri/example_flow_quickstart_no_slack is re-triggered with the same input within this period, Windmill will immediately return the cached result.
Cache flow steps
Caching a flow step means caching the results of that step for a certain duration. If the step is triggered with the same inputs during the given duration, it will return the cached result.
You can enable caching for a step directly in the step configuration. Here's how you can do it:
Select a step: From the Flow Editor, select the step for which you want to cache the results.
Enable Caching: To enable caching, navigate to the
Advancedmenu and select
Cache. Toggle it on and specify the desired duration for caching results (in seconds.)
In the above example, the result of step
a will be cached for 86400 seconds (1 day). If
a is re-triggered with the same input within this period, Windmill will immediately return the cached result.
Step mocking allows faster iteration. When a step is mocked, it will immediately return the mocked value without performing any computation.
Caching is a powerful tool that can optimize your workflows in Windmill. By caching the results, you can eliminate unnecessary computation and accelerate your workflows.
However, it's essential to use caching judiciously: while it can greatly enhance efficiency, overusing the cache or using it for unsuitable scripts or flows can result in outdated results or unwarranted memory usage. Always consider the nature of your step and the data it processes when deciding whether to enable caching.