Syvizo

Add Cache



When to use

Use this policy when you want to force the addition of value in cache. When used the cache lookup is not done and data from the request is set in the cache without making call to the backend API.



Details

This policy forces the cache add and disregards the cache time to live value. This is useful when the data in the cache is known to be stale and there is still some time for the cached data to expire. Or you want to send certain data for the requests which may or may not be sent from the backend API call. The data to be set in cache is taken from the cacheValue field of the policy.


Without this policy, the cache is refreshed only after the cache expiry happens and with the data from the backend API call.



Configuration

The configuration fields for the policy are:

[* Indicates a mandatory field]

Name *: Display name of the policy

Description: Description of policy

Enabled: Flag to indicate if the policy is enabled. If this field is not checked, the policy will be ignored at runtime and any fields from its output will contain a default initial value

Continue on Error: Flag to indicate that the flow should continue even if this policy throws an error

TTL in seconds: Cache Time to live specifies how long after cache is valid after added. If present, this overrides Expiry date and expiry time. The cache will be removed after this time is elapsed and for any next request, the cache data will be re-populated with the response from the backend API call



Input fields

cacheKey: Key based on which cache lookup is done

cacheValue: Value to be set in cache



Output fields

status: returns boolean true if the data is added in cache, otherwise returns false