-
Notifications
You must be signed in to change notification settings - Fork 20
/
doxygen_main_page.txt
57 lines (35 loc) · 2.24 KB
/
doxygen_main_page.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*! \mainpage
Hotrod is Infinispan's custom binary protocol that enables fast client/server interaction. The Hotrod C++ Client library provides API features that allow the developement of Infinispan based C++ applications.
A common hotrod session is as follows:
1. Build a configuration
2. Start the connection
3. Use the cache
4. Close the connection
## Build a configuration
The application must configure an infinispan::hotrod::ConfigurationBuilder object with all the specific settings. A simple configuration could looks like this:
infinispan::hotrod::ConfigurationBuilder builder;
builder.addServer().host("127.0.0.1").port(11222);
builder.protocolVersion(infinispan::hotrod::Configuration::PROTOCOL_VERSION_24);
## Start the connection
Then an infinispan::hotrod::RemoteCacheManager can be created and started:
RemoteCacheManager cacheManager(builder.build(), false);
cacheManager.start();
and, if needed, a specific data marshalling policy could be setup:
## Use the cache
All the cache operations are accessible via the infinispan::hotrod::RemoteCache class. This class also takes care of the (un)marshalling of the cache data, an infinispan::hotrod::JBasicMarshaller is instantiated by default, otherwise additional setup is required:
JBasicMarshaller<int> *km = new JBasicMarshaller<int>();
JBasicMarshaller<std::string> *vm = new JBasicMarshaller<std::string>();
RemoteCache<int, std::string> cache = cacheManager.getCache<int, std::string>(km,
&Marshaller<int>::destroy,
vm,
&Marshaller<std::string>::destroy);
... you can now do cache operations ...
Main categories of operation on the cache are:
+ Common operation (infinispan::hotrod::RemoteCache.get(),infinispan::hotrod::RemoteCache.put())
+ Server side execution of script (infinispan::hotrod::RemoteExecution)
+ Event listener setup (infinispan::hotrod::RemoteCache.addClientListener())
+ Queries and continuous query (infinispan::hotrod::RemoteCache.query(), infinispan::hotrod::RemoteCache.addContinuousQueryListener())
## Close the connection
Just clean up after yourself: this also stops all the registered listeners on the server.
cacheManager.stop();
*/