diff --git a/docs/memoization.md b/docs/memoization.md index 8945013433d1..f63de41ba3e1 100644 --- a/docs/memoization.md +++ b/docs/memoization.md @@ -15,8 +15,9 @@ This allows you to easily manipulate cache entries manually through `kubectl` an ## Using Memoization -Memoization is set at the template level. You must specify a key, which can be static strings but more often depend on inputs. -You must also specify a name for the config-map cache. +Memoization is set at the template level. You must specify a `key`, which can be static strings but more often depend on inputs. +You must also specify a name for the `config-map` cache. +Optionally you can set a `maxAge` in seconds or hours (e.g. `180s`, `24h`) to define how long should it be considered valid. If an entry is older than the `maxAge`, it will be ignored. ```yaml apiVersion: argoproj.io/v1alpha1 @@ -29,11 +30,14 @@ spec: - name: whalesay memoize: key: "{{inputs.parameters.message}}" + maxAge: "10s" cache: configMap: name: whalesay-cache ``` +[Find a simple example for memoization here](https://github.com/argoproj/argo-workflows/blob/master/examples/memoize-simple.yaml). + !!! Note In order to use memoization it is necessary to add the verbs `create` and `update` to the `configmaps` resource for the appropriate (cluster) roles. In the case of a cluster install the `argo-cluster-role` cluster role should be updated, whilst for a namespace install the `argo-role` role should be updated.