cache
Cache the result of an expression or lookup
Cache the result of an expression or lookup. Caching avoids re-evaluating the expression or re-querying Redis when the same input field values appear repeatedly. Cache keys are derived from the values of the input fields referenced by the expression, not from the full record.
The cache: block can be added to the following transformations and
output expressions:
- The expression in
add_field(single-field and per-item form). - The expression in
filter. - The expression in
map. - The argument expressions in
redis.lookup. The same block accepts alookup_cache:variant that caches the lookup result returned by Redis. - The dynamic
keyandexpireexpressions of theredis.writeoutput.
Flink processor only. The classic processor silently ignores cache: blocks.
Properties
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| enabled | boolean |
Set to true to enable caching. |
no | false |
| max_size | integer |
Maximum number of entries kept in the cache. Must be positive. | no | 1000 |
| ttl_seconds | integer |
Time-to-live for each entry, in seconds. Must be positive. | no | 60 |
Additional Properties: not allowed
Example
source:
schema: dbo
table: customer
transform:
- uses: add_field
with:
field: country
language: sql
expression: country_code || ' - ' || UPPER(country_name)
cache:
enabled: true
max_size: 500
ttl_seconds: 300
See Caching expression results for additional examples.