SaveToCache

Step takes any input data and saves it to a cache with the specified key. The key the data was saved with is saved for the next step

Added in version 1.0.0.

  • Friendly name: Cache Save

  • Step class: base_steps_syncpack.steps.SaveToCache.SaveToCache

  • Step version: 1.0.3

  • Required parameters: save_key

Parameters

Name

Type

Required

Default

Description

save_key

string

yes

–

The key for which to save this data with Example: keyA

parse_only

string (multi-line)

no

–

Only save data from a specific key

chunk_size

number

no

5000

Advanced value for specifying how many items should be in the chunked setsif the data is larger than the 20mb limit. Example: 10

read_from_api

boolean

no

False

Cache available for being requested from the API

Every step also accepts the platform parameters common to all steps – see Platform parameters.

Dependencies

  • Inherits from: SaveToCache -> BaseStep -> Serializable

  • External packages: ipaascommon, ipaascore, isbaseutils

Behaviour

Takes the previous step’s data and writes it to the cache under save_key. When parse_only is set, only that key of the incoming data is saved rather than the whole object.

Data larger than Couchbase’s 20 MB document limit is split into numbered chunks — key::1, key::2, and so on — transparently, chunk_size items at a time.

Outputs

{"save_key": "my-base-key"}

The un-suffixed base key, even when the data was chunked. Pass this straight to ReadFromCache, which reassembles the chunks.

Raises StepFailedException when the resolved data is None, or when data exceeds 20 MB and is not a list or dict (there is no way to chunk a scalar).

Example

{"save_key": "snow-open-incidents", "chunk_size": 5000}

Notes

  • read_from_api only does something when the platform’s save_to_cache supports it — Skylar Automation / PowerFlow later than 2.3.0. On older platforms the parameter is accepted and ignored.

  • Pair the key with ReadFromCache using lookup_type equals for an exact key, or like to sweep up a chunked or prefixed set.

  • Nothing expires these entries automatically. A workflow that writes per-run keys needs DeleteFromCache to clean up, or the bucket grows without bound.

API

class base_steps_syncpack.steps.SaveToCache.SaveToCache

Bases: BaseStep

execute()

All logic main logic for executing the step happens here

Returns:

chunks_of_supported_size(data_to_cache, set_size)

Couchbase only accepts sizes of less than 20mb to be put in the db. If the obj is greater than 20mb, then break it up into chunks. Returns a lis

chunk_set(data_to_cache, set_size)

Breaks up a given list or dictionary into chunks of a size specified by the step parameter chunk_size

Parameters:

data_to_cache

Returns: