ReadFromCache
Step reads data from cache using save_key, sets the returned data for next step.
Added in version 1.0.0.
Friendly name:
Cache ReadStep class:
base_steps_syncpack.steps.ReadFromCache.ReadFromCacheStep version:
1.4.0Required parameters:
save_key,lookup_type
Parameters
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
yes |
– |
The key with which to read from the cache Example: |
|
enum |
yes |
|
How to perform the search from cache. Can either be ‘equals’, or ‘like’ |
|
boolean |
no |
|
Try to combine the results into a single list |
|
string |
no |
– |
Value to return if None Example: |
Every step also accepts the platform parameters common to all steps – see Platform parameters.
Dependencies
Inherits from:
ReadFromCache->BaseStep->SerializableExternal packages:
couchbase,ipaascommon,ipaascore,isbaseutils
Behaviour
Reads one or more cache entries and passes them downstream. lookup_type
selects how save_key is matched:
equalsExact key match.
likePrefix or pattern match. Keys are resolved with
get_ids_from_logs_bucket_startswith, falling back to an N1QLMETA().id LIKEquery (INT-6201). This is what reassembles thekey::1,key::2chunks written by SaveToCache.
Outputs
The retrieved data:
merge_resultstrue (the default) — all matches merged into one structure;merge_resultsfalse — a list with one entry per matching key.
When nothing matches, the output is default_value if one is set, otherwise an
empty list [].
Example
{
"save_key": "snow-open-incidents",
"lookup_type": "like",
"merge_results": true
}
Notes
A miss is not an error. The step saves
[]and the workflow continues, so a downstream step has to handle the empty case — a typo insave_keylooks exactly like an empty cache.Use
likefor anything written by SaveToCache that might have been chunked. Withequalsyou get only the un-suffixed base document, which for chunked data is not the full set.merge_resultschanges the output shape. Flipping it breaks downstream steps written against the other form.
API
- class base_steps_syncpack.steps.ReadFromCache.ReadFromCache
Bases:
BaseStep- execute()
All logic main logic for executing the step happens here
- Returns:
- get_id_list(lookup_type)
Return the list of keys associated with the cache entries we need to retrieve
- Parameters:
lookup_type (str) – see step parameter
Returns:
- get_cache_data_with_keys(id_list)
Return a list of teh contents for each id queried
- Parameters:
id_list (list) – ids to query for
Returns list: