March 2010
Intermediate to advanced
408 pages
9h 59m
English
In this section, we will finally write some C++ cache-related code. Let's start by obtaining a NamedCache from the CacheFactory:
NamedCache::Handle hCache = CacheFactory::getCache("accounts");We can then proceed to operate on the cache in much the same way as we did in Java:
String::View vsKeySRB = "SRB";
String::View vsKeyUSA = "USA";
hCache->put(vsKeySRB, String::create("Serbia"));
hCache->put(vsKeyUSA, String::create("United States"));
hCache->put(vsKeyUSA, String::create("United States of America"));
hCache->remove(vsKeySRB);
std::cout << vsKeyUSA << " = " << hCache->get(vsKeyUSA) << std::endl;
std::cout << "Cache size = " << hCache->size() << std::endl;
hCache->clear();The C++ NamedCache interface ...
Read now
Unlock full access