Shared key value store
Store and share common data between different components of your application using the shared key value store in Optimizely Connect Platform (OCP).
The App SDK provides a shared key value store instance available to all your application components. This store exposes the same key value store interface as the regular key value store and is intended as a way to share common data between different components of your application when the account isolation that the regular key value store provides is not necessary or is limiting.
A common problem this store solves is the persistence of mapping data between third-party systems and Optimizely Data Platform (ODP) accounts. For example, mapping source system account identifiers to Optimizely Connect Platform (OCP) app install IDs. It is only required when a global function is included as part of the application but its usage is not limited to this setup. For more information on global functions, see Global functions.
import {storage} from '@zaiusinc/app-sdk';
await storage.sharedKvStore.put(sourceSystemId, zaiusInstallId);
Important
As a shared resource, take care with key namespacing to avoid key clobbering. Like the regular key value store, do not write sensitive data such as API keys, API tokens, or usernames and passwords to the key value store. While the data is encrypted at rest, it does not have the same level of security as the secrets or settings stores and is not suitable for storing sensitive information.
Updated 12 months ago