cache

Cache policy allows a user to cache complex results whether it be from remote sources or expensive local calculations.

Table 1. Supported parameters
Parameter Required Data type Details
execute Yes array List of actions to run. Execute will either produce ALL results, or return an error
expire Yes object Define how time-to-live is determined for cache entries
inputs Yes array List of CacheInputs to identify the cached entry
outputs Yes array List of CacheTypes to specify what items to cache
scope No object Specify the scope of key when caching, defaults to NarrowScope
Table 2. Options for execute
Options Required Data type Details
authenticate Yes object Authenticate request based on extracted identity
authorize Yes object Authorize access for an authenticated request
azureOpenAiChatCompletions Yes object API Endpoint call for Azure Open AI backend server, POST Chat Completions URI
azureOpenAiEmbeddings Yes object API Endpoint call for Azure Open AI backend server, POST Embeddings URI
azureOpenAiModels Yes object API Endpoint call for Azure Open AI backend server, GET Models URI
azureOpenAiModelsId Yes object API Endpoint call for Azure Open AI backend server, GET Models/{model_id} URI
block Yes object Block a request based on configured criteria
cache Yes object Cache policy allows a user to cache complex results whether it be from remote sources or expensive local calculations.
circuitBreaker Yes object Run an execute, count concurrency or failures. If limits are exceeded then run a fallback execute
setAuthorization Yes object Sets the Authorization header
cors Yes object Configure gateway support for CORS (Cross-Origin Resource Sharing)
countLimit Yes object Enforce simultaneous access to resources
extractIdentity Yes object Extract the identity
handlebarsTemplate Yes object Generate String value or payload using Handlerbars template
ibmCloudLogin Yes object Login to IBM Cloud using pre-configured credentials
if Yes object Run an execute block if a condition is met
invoke Yes object Call an external endpoint (Currently Http(s))
invokeAwsLambda Yes object Invoke AWS lambda function
loadBalancer Yes object Distribute traffic across multiple endpoints
luaScript Yes object Run LuaScript code
openAiChatCompletions Yes object API Endpoint call for Open AI backend server, POST Chat Completions URI
openAiEmbeddings Yes object API Endpoint call for Open AI backend server, POST Embeddings URI
openAiModels Yes object API Endpoint call for Open AI backend server, GET Models URI
openAiModelsId Yes object API Endpoint call for Open AI backend server, GET Models/{model_id} URI
operationSwitch Yes object Execute a series of policies conditioned on API path and/or verb
or Yes object Run a single action or an execute, if it fails run the next in a list until success
parse Yes object Parse the payload of a message
rateLimit Yes object Limit the rate of access to a specified resource
retryIterator Yes object Run an execute block, catch specified errors and retry up to a specified number of times the same execute block
return Yes object Complete execution of an assembly earlier with the success result
redact Yes object Redact message payload, header, variable, query parameters, and telemetry
remove Yes object Remove message payload, header, variable, query parameters, and telemetry
set Yes object Set specified fields on the Assembly Context
sqlInjectionFilter Yes object Scans payload and/or URI for SQL injection attacks
transform Yes object Transform message payload, header, variable, uri, and telemetry
switch Yes object Run the first assembly that matched the given expressions
throw Yes object Complete execution of an assembly with an error result
try Yes object Create a block of assembly actions, containing catch block to handle errors during their execution and finally to unconditionally execute actions after the block
userDefined Yes object Call into an assembly defined as a separate ConfigMap
validate Yes object Validate request
watsonxModels Yes object API Endpoint call for Watson X backend server, GET Models URI
watsonxTextGen Yes object API Endpoint call for Watson X backend server, POST Text Generation URI
watsonxTokenize Yes object API Endpoint call for Watson X backend server, POST Tokenize URI
geminiModels Yes object API Endpoint call for Gemini backend server, GET Models URI
geminiModelsId Yes object API Endpoint call for Gemini backend server, POST Generate Content URI
geminiGenerateContent Yes object API Endpoint call for Gemini backend server, POST Generate Content URI
geminiEmbedContent Yes object API Endpoint call for Gemini backend server, POST Batch Embeddings URI
geminiBatchEmbedContents Yes object API Endpoint call for Gemini backend server, POST Batch Embeddings URI
geminiCountTokens Yes object API Endpoint call for Gemini backend server, POST Count Tokens URI
telemetry No object Defines custom telemetry attributes for the cache operation
tittle No string or null Specifies a custom title for the cache operation
Table 3. Nested properties inside telemetry
Property Required Data type Details
additionalProperties No string Each additional property must conform to the following schema
Table 4. Options for expire
Property Required Data type Details
fromMessageHeader Yes object Get time-to-live from specified message header
fromVariable Yes object Get time-to-live from specified variable
fromCacheControl Yes object Use the Cache-Control header from the specified message
static Yes object Use specified value as time-to-live for each cache entry
Table 5. Nested properties inside fromMessageHeader
Property Required Data type Details
headerName Yes string The name of the HTTP header from which the cache-related message value will be extracted
messageName Yes string The name of the message or variable that will store the extracted value from the specified header
Table 6. Nested properties inside fromVariable
Property Required Data type Details
name Yes string Specifies the exact name of the HTTP header from which the cache-related value should be retrieved
Table 7. Nested properties inside fromCacheControl
Property Required Data type Details
messageName Yes string The name of the message or variable that will store the extracted value from the specified header
Table 8. Nested properties inside static
Property Required Data type Details
seconds Yes object Specifies the duration of the cache entry in seconds. Value must be greater or equal to 0.0
Table 9. Options for inputs
Property Required Data type Details
custom Yes object Use a JSONata expression to calculate an identifier
message Yes object Use the whole message as an identifier
messageBody Yes object Use the value of the specified body as an identifier
messageHeader Yes object Use the value of the specified header as an identifier
variable Yes object Use the value of the specified variable as an identifier
Table 10. Nested properties inside custom
Property Required Data type Details
expression Yes string Specifies a JSONata expression used to calculate a custom identifier or value dynamically
Table 11. Nested properties inside message
Property Required Data type Details
name Yes string Name of the message
Table 12. Nested properties inside messageBody
Property Required Data type Details
name Yes string Name of the message
Table 13. Nested properties inside messageHeader
Property Required Data type Details
headerName Yes string Name of the header
messageName Yes string Name of the message
Table 14. Nested properties inside variable
Property Required Data type Details
name Yes string Name of the variable
Table 15. Options for outputs
Property Required Data type Details
message Yes object Use the whole message as an identifier
messageBody Yes object Use the value of the specified body as an identifier
messageHeader Yes object Use the value of the specified header as an identifier
variable Yes object Use the value of the specified variable as an identifier
Table 16. Options for scope
Property Required Data type Details
narrowScope Yes object Use routing config's basepath, subdomain, hash of cache action and group id as a prefix when creating the key
info needed