Class: StorageClient

Storage Client


The Storage client handles saving and retrieving data for your application.

TODO
  • add clear method

Methods

delete
(params)

clients/storageClient.js, line 155

Delete a value from storage.

Name Type Description
params Object

Params object

Name Type Description
key String

The key to get from storage

Example
StorageClient.delete({key:"testKey"})

get
(params, cb)

clients/storageClient.js, line 98

Get a value from storage.

Name Type Description
params Object

Params object

Name Type Description
key String

The key to get from storage

cb function optional

callback to be called on success

Example
StorageClient.get({topic:"finsemble", key:"testKey"}, function(err, data){
	var myData = data;
});

keys
(params, cb)

clients/storageClient.js, line 121

Get all keys for the topic.

Name Type Description
params Object

Params object

Name Type Description
topic String

topic for the keys to return

keyPrefix String optional

filter all keys that don't start with this prefix

cb function optional

callback to be called on success

Example
StorageClient.keys({topic:"finsemble", keyPrefix:"test"}, function(err, data){
	var myKeys = data;
});

save
(params, cb)

clients/storageClient.js, line 78

Save a key value pair into storage.

Name Type Description
params Object

Params object

Name Type Description
topic String

storage topic for key being stored

key String

The key to be stored

value Param

The value to be stored

cb function optional

callback to be called on success

Example
StorageClient.save({topic:"finsemble", key:"testKey", value:"testValue"})

setStore
(params, cb=)

clients/storageClient.js, line 58

Specifies the datastore. For normal operation this function doesn't have to be invoked -- the default datastore is set in configuration.

Name Type Description
params Object

Params object

Name Type Description
topic String optional

if specificed then data store is set only for topic

dataStore Param

identifies the data store (e.g. "localStorage", "redis")

cb= function optional

callback to be called on success

Example
StorageClient.setStore({topic:"finsemble", dataStore:"redis"})

setUser
(params, cb)

clients/storageClient.js, line 38

Define the username for storage (i.e. each user has unique storage)

Name Type Description
params Object

Params object

Name Type Description
user String

user name

cb function optional

callback to be called on success

Example
StorageClient.setUser("JohnDoe");