Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleExample - Using dsStoreManyUDRs


Code Block
any storage = null;
 
initialize {
    storage = dsInitStorage("default.ds_profile");
    if(null != dsLastErrorMessage()) {
        //Error Handling
    } 
}
 
consume { 
    map<string, drudr> myUDRs = mapCreate(string, drudr);
    default.dataUDR udr1 = udrCreate(default.myultra.dataUDR); 
    mapSet(myUDRs,"first", udr1);
    default.dataUDR udr2 = udrCreate(default.myultra.dataUDR); 
    mapSet(myUDRs,"second", udr2); 
    dsStoreManyUdrs(storage, myUDRs, null); 
    if(null != dsLastErrorMessage()) {
        //Error Handling
    } 
}


dsCommand


Note
titleNote!

This function is only valid for Couchbase.

The dsCommand function stores data with a Time To Live (TTL) on the entry by updating the ‘expiration’ field for data in Couchbase, meaning it will be removed when it gets too old.

Code Block
void dsCommand(
 any profid, 
 string "ttlStore"
 string key, 
 int ttl,
 drudr myUDR)

You can also use the dsCommand to extend the expiration field of the data in Couchbase using the “touch” action.

Code Block
void dsCommand(
 any profid, 
 string "touch"
 string key, 
 int ttl)


Parameter

Description

profid

The Distributed Storage profile.

action

The action you want to perform, “ttlStore” for storing UDRs with TTL or “touch“ to extend the TTL.

key

The key of a key-value pair.

ttl

Time To Live in seconds.

myUDR

The UDR to be stored.

Returns

Nothing.


Info
titleExample - Using dsCommand


Code Block
int ttl = 50;
any result = dsCommand(storage, "ttlStore", "3333", ttl,input);
debug(result);
sleep(10000);
result = dsCommand(storage, "touch", "3333", ttl);



dsRemove

The dsRemove function removes a key-value pair, identified by a key, from a distributed storage.

...