Skip to main content
Version: Next

Flow Configuration Template

This document provides the configuration template for implementing the Caching Flow, enabling efficient and reliable caching of API responses based on URLs, query parameters, headers, and other request properties.

Flow Configuration

name: CachingFlow

filter:
url: api.example.com/v1/resources/* # Define the URL pattern for caching specific API endpoints. Note: this can also be set to an IP instead of a DNS.

processors:
ReadCache:
processor: ReadCache # Reads responses from the cache if available.
parameters:
- key: caching_key_parts
value:
- $.request.header.api_key
- $.request.query_param.resource_id
- $.request.url.path_param.organization

WriteCache:
processor: WriteCache # Writes responses to the cache.
parameters:
- key: ttl_seconds
value: 600 # Cache time-to-live set to 10 minutes.
- key: record_max_size_bytes
value: 8192 # Maximum size of cached responses is 8 KB.
- key: max_cache_size_megabytes
value: 200 # Cache size limited to 200 MB.
- key: caching_key_parts
value:
- $.request.header.api_key
- $.request.query_param.resource_id
- $.request.url.path_param.organization

flow:
request:
- from:
stream:
name: globalStream
at: start
to:
processor:
name: ReadCache

- from:
processor:
name: ReadCache
condition: cache_miss
to:
stream:
name: globalStream
at: end

response:
- from:
stream:
name: globalStream
at: start
to:
processor:
name: WriteCache

- from:
processor:
name: WriteCache
to:
stream:
name: globalStream
at: end

- from:
processor:
name: ReadCache
condition: cache_hit
to:
stream:
name: globalStream
at: end

Processor Configuration Tables

ReadCache Processor

ParameterDescriptionTypeMandatory/OptionalExample
caching_key_partsKey used to normalize the API request path for caching.StringMandatory"api.example.com/v1/resources"

WriteCache Processor

ParameterDescriptionTypeMandatory/OptionalExample
ttl_secondsCache time-to-live in seconds.IntegerMandatory600
record_max_size_bytesMaximum size of cached responses, in bytes.IntegerMandatory8192
max_cache_size_megabytesMaximum size of the cache created by this processor, in megabytes.IntegerOptional (default: 100)200
caching_key_partsKey used to normalize the API request path for caching.StringMandatory"api.example.com/v1/resources"