Implementing a Coherence C++ client application
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 ...
Get Oracle Coherence 3.5 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.