About the C++ Client API
The C++ client API allows C++ developers to programmatically create, populate, and manage a distributed system. The C++ library is thread-safe, except where specified otherwise.
This chapter gives a general overview of the classes in the
apache::geode::client namespace. For complete and current information on the classes listed here, see the C++ API.
The C++ client API has the following cache classes:
- CacheFactory. Use this class to create and configure a
cache.xmlis specified, the cache is created based on the declarations loaded from that file.
- Cache. Entry point to the client caching API. The cache is created by calling the
createfunction of the factory class,
CacheFactory. Regions are configured and obtained using the
The C++ client API has the following region classes:
- Region. Provides functions for managing regions and cached data. Use these functions to perform the following actions:
- Retrieve information about the region, such as its parent region and region attribute objects.
- Invalidate or destroy the region.
- Create, update, invalidate and destroy region entries.
- Retrieve region entry keys, entry values, and RegionEntry objects, either individually or as entire sets.
- Retrieve the statistics object associated with the region.
- Set and get user-defined attributes.
- RegionEntry. Contains the key and value for the entry, and provides all non-distributed entry operations. This object’s operations are not distributed and do not affect statistics.
Region Attribute Classes
The native client C++ API has the following region attribute classes:
- RegionAttributes. Holds all attribute values for a region and provides functions for retrieving all attribute settings. This class can be modified by the
AttributesMutatorclass after region creation.
- AttributesMutator . Allows modification of an existing region’s attributes for application plug-ins and expiration actions. Each region has an
Application Plug-In Classes
The C++ client API has the following application plug-in classes:
- CacheLoader. Loads data into a region on a cache miss.
- CacheWriter. Synchronously handles region and entry events before the events occur. Entry events are
destroy. Region events are invalidate and destroy. This class has the ability to abort events.
- CacheListener. Handles region and entry events after they occur. Entry events are
destroy. Region events are
Event Handling Classes
The C++ client API has the following event handling classes:
- RegionEvent. Provides information about the event, such as in what region the event originated, whether the event originated in a cache remote to the event handler, and whether the event resulted from a distributed operation.
- EntryEvent. Provides all available information for the
RegionEvent, and provides entry-specific information such as the old and new entry values and whether the event resulted from a
StatisticsType API represents a blueprint for the same type of
StatisticsType API is a collection of
StatisticDescriptor. Internally, each
StatisticDescriptor describes data of each individual statistic.
StatisticsFactory provides functionality for creating
- CacheStatistics –This class defines common statistics functions.
RegionEntryboth have functions that return a
CacheStatisticsobject for accessing and resetting their statistics counts.
- StatisticDescriptor. An instance of this class describes a statistic whose value is updated by an application and may be archived by the native client. Each statistic has a type of either
double, and either a gauge or a counter. The value of a gauge can increase and decrease, and the value of a counter strictly increases. Create an instance of
StatisticDescriptorby calling one of these
- StatisticsType. An instance of this class describes a logical collection of
StatisticDescriptors. These descriptions are used to create an instance of
Statistics. Create an instance of
- Statistics. An instance of this class represents concrete
Statisticsof the associated
StatisticsType. This class stores data related to all individual statistic objects. Create an instance by calling
StatisticsFactory::createStatistics. This class has functions to get, set, and increment statistic values.
- StatisticsFactory. This class provides functions for creating instances of
Statistics objects. This is a singleton class, and you acquire its instance by using
To create new statistics, see Creating New Statistics.