Sidebar

How can I verify a MessageCache Variable exists and is populated

0 votes
304 views
asked Sep 12, 2016 by brandon-w-8204 (33,170 points)

1 Answer

+1 vote

Here is some code on how to test messageCache:

//Test if a messageCache Exists.
var result = messageCache.getValue('doesNotExist');
var string = '';
if (result) {
   string += '"' + result + '" equals: true';
} else {
   string += '"' + result + '" equals: false';
}
 
qie.debug('Returned if you getValue of a messageCache does not exist:\n' + result + '\n' + string);
 
//Using a default value of notFound
result = messageCache.getValue('doesNotExist', 'notFound');
string = '';
if (result != 'notFound') {
   string += 'messageCache Value "doesNotExist" is not found';
} else {
   string += 'messageCache Value "doesNotExist" is found';
}
 
qie.debug('Returned if you getValue of a messageCache does not exist:\n' + result + '\n' + string);
answered Sep 12, 2016 by brandon-w-8204 (33,170 points)
...