Accessing BigMemory Data from Your Application
This section provides basic code snippets for accessing BigMemory data from your application. For more explanation, refer to
Using the .NET Client API. For the complete class library documentation, refer to the API documentation in the
/apis/cpp/apidoc-cpp.zip directory of the kit.
Create a CacheManager
This snippet creates a CacheManager configuration that uses the Nirvana Shared Memory (SHM) transport and provisions a pool of 10 connections.
XPlatform::createCacheManager(terracotta::ehcache::config::Configuration("/dev/shm", 10));
Retrieve a Cache from the CacheManager
This snippet can be used with the .NET client demo samples in the kit (see
demo code samples). Notice that a serializer must be specified.
cacheManager->getCache(cacheName, RecipeProtoBufSerializer());
Get or put entries into the cache
This snippet can be used with the .NET client demo samples in the kit (see
demo code samples). Notice that you have the option to call the configured consistency type for get and put operations.
cache->put(key, recipeStructure, type);
Search
Searches of BigMemory data can be made using the BigMemory Structured Query Language (SQL). Refer to the
Search section in
Using the C++ Client API.