Workflow data persistence
When you call a get method on a relevant data item, you load the data from the persistent data store into an in-memory cache. If another activity in the workflow calls a get method on the same data item, it uses the same cached copy.
When we use the addProperty, setProperty, or removeProperty methods, you update the cached copy of the data. The set method writes your changes from the cache back to the persistent data store.
The addProperty, setProperty, and removeProperty methods do not automatically write their changes to persistent storage for two reasons: performance and data integrity. There is a performance cost associated with each write process. To minimize overhead, a single write process can be executed after all attributes have been modified. Think of the set method as a database transaction commit. You would not want the persistent storage to be updated with only a portion of your changes if the server suddenly became unavailable. Using the set method as a transaction commit allows all or none of the changes to be committed to persistent storage.
Parent topic: Workflow data in JavaScript code