Class: StorageClient
Storage Client (Finsemble Connect)
The Storage Client handles saving and retrieving data for your smart desktop.
See the Storing Data tutorial for an overview of using the Storage Client.
Methods
-
clearCache(cb)
-
Clears a storage adapter of all data.
Name Type Description cbStandardErrorCallback optional -
get(params, cb)
-
Get a value from storage.
Name Type Description paramsName Type Description keystring The key to get from storage.
topicstring The topic that the data is saved under.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.get({ topic:"finsemble", key:"testKey" }, function(err, data) { var myData = data; }); -
getStandardized(params, cb)
-
Get a value from storage.
Name Type Description paramsName Type Description keystring The key to get from storage.
topicstring The topic that the data is saved under.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.getStandardized({ topic:"finsemble", key:"testKey" }, function(err, data) { let myData = data; }); const {err, data} = await FSBL.Clients.StorageClient.getStandardized({ topic:"finsemble", key:"testKey" }); -
keys(params, cb)
-
Get all keys for the topic.
Name Type Description paramsName Type Description keyPrefixoptional Filter all keys that don't start with this prefix.
topicstring Topic for the keys to return.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.keys({topic:"finsemble", keyPrefix:"test"}, function(err, data){ let myKeys = data; }); const {err, data} = await FSBL.Clients.StorageClient.keys({topic:"finsemble", keyPrefix:"test"}); -
remove(params, cb)
-
Delete a value from storage.
Name Type Description paramsName Type Description keystring The key to get from storage.
topicstring The topic that the data is saved under.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.remove({ key:"testKey" }) await FSBL.Clients.StorageClient.remove({ key:"testKey" }) -
save(params, cb)
-
Save a key value pair into storage.
Name Type Description paramsComponentMutateParams Name Type Description fieldoptional Field to save.
fieldsoptional Fields to save.
keyoptional Key to store the data under.
stateVaroptional Whether the data is componentState or windowData. Defaults to "windowData"
topicoptional Topic that the data is stored under.
valueany optional Value to save.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.save({topic:"finsemble", key:"testKey", value:"testValue"}); FSBL.Clients.StorageClient.save({topic:"finsemble", key:"testKey", value:"testValue"}, (err, data) => {}); const {err, data} = await FSBL.Clients.StorageClient.save({topic:"finsemble", key:"testKey", value:"testValue"}); -
setStore(params, cb)
-
Specifies the data store. For normal operation this function doesn't have to be invoked -- the default data store is set in configuration.
Name Type Description paramsName Type Description dataStoreoptional Identifies the data store (e.g. "localStorage", "redis").
topicstring If specified then data store is set only for topic.
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.setStore({topic:"finsemble", dataStore:"redis"}) -
setUser(params, cb)
-
Define the user name for storage (i.e., each user has unique storage).
Name Type Description paramsName Type Description userstring A unique key to store user data under
cbStandardErrorCallback optional Example
FSBL.Clients.StorageClient.setUser({ user: "JohnDeere"});