Saving temporary data
It is possible to save certain data between service calls. This is what the object is for registry called from the local context (context.registry()).
The object requires a running application EximeeRegistry.
Available methods
Object registry provides the following methods for managing stored data:
save(namespace, id, data)
Saves the provided data under the specified identifier.
saveVersion(namespace, id, data, version)
Saves data with version verification. If the version field is unset or empty, the save occurs without verification. If the value of the field version does not match the current version of the stored data, the request will end with an error.
get(namespace, id)
Retrieves the saved data (returns only the content).
getVersion(namespace, id)
Retrieves the saved data along with its current version. Returns an object with the structure: { data: 'saved data', version: 'current data version' }.
delete(namespace, id)
Deletes the saved data from the specified namespace.
Namespace and data lifecycle
Namespaces (namespace): Data is stored in separate namespaces defined by administrators.
Lifetime (TTL): Each namespace can be assigned an individual data lifetime. By default, it is 90 days.
Update: Providing the same
idacross several save calls updates the data associated with that identifier.Versioning: The data version is a unique identifier automatically generated with each data save (or update). Each save creates a new version of the entry. With
saveVersionit is possible to provide a version for verification — if it does not match the current one, the save will be rejected.nullmeans a forced save, without checking the version.
Usage examples
The script below presents the lifecycle of temporary data from saving, through reading, safe update with version verification, to deletion:
Last updated
Was this helpful?
