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/csharp/apidoc-csharp.zip directory in 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(new
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
.NET Client Demo Samples). Notice that a serializer must be specified.
cacheManager.GetCache("TestCache", new RecipeSerializer());
Get or put entries into the cache
This snippet can be used with the .NET client demo samples in the kit (see
.NET Client Demo Samples). Notice that you have the option to specify a consistency type for get and put operations.
cache.Put(recipe.name, recipe, ConsistencyType.STRONG);
Close the CacheManager
cacheManager.Close();
Search
Searches of BigMemory data can be made using the BigMemory Structured Query Language (SQL). Refer to
Search.