Data Storage
The data storage API is an awaited feature in Sitevision 5 that enables data storage for WebApps and RESTApps. The API introduces two types of data stores and data must be valid JSON data.
The data storage technology is designed to work with clustered data and uses partial data updates to ensure cluster safety. The API is designed to be powerful and easy to work with.
Data Store types
There are two types of Data stores. They share the restrictions and error handling behaviour for but they have their own type-specific API:
- Key/value Data Store - a single key/value item
- Collection Data Store - a collection of key/value items
Restrictions
- The data storage API is available in WebApps and RESTApps.
- Data stored in a data store must be be JSON serializable
- A data store record is restricted to a maximum of 50 top level properties
- A record is the the value in a key-value data store or an item in a collection data store
- If property count is exceeded, record will be unavailable. Properties can be removed by setting it to
null
- Top level property keys are restricted to a maximum of 100 characters
- Property values are restricted to a maximum of 5000 characters
- A value is the data stored on a top level property
- Keys dsid and dstimestamp are populated by the API itself (i.e. never try to mutate/store data for such key since your data/value will be overwritten by the API).
- Keys dsid and dstimestamp are internal values and may change at any time.
- The values of dsid and dstimestamp should NOT be used as identifiers. They will change, for instance, if the website is exported and imported.
- If there is a need for persistant keys or timestamps, for instance to connect posts in 2 separate datastores, set up custom fields as unique keys for this purpose.
Accessing a Data Store
WebApps and RESTApps that wants to use a Data Store must state its intentions in the "storage" section of the app's manifest.