11.9.3. Hot Rod Java Client Basic API
The following code shows how the client API can be used to store or retrieve information from a Hot Rod server using the Hot Rod Java client. This example assumes that a Hot Rod server has been started bound to the default location,
localhost:11222.
Example 11.3. Basic API
The
RemoteCacheManager corresponds to DefaultCacheManager, and both implement CacheContainer.
This API facilitates migration from local calls to remote calls via Hot Rod. This can be done by switching between
DefaultCacheManager and RemoteCacheManager, which is simplified by the common CacheContainer interface.
All keys can be retrieved from the remote cache using the
keySet() method. If the remote cache is a distributed cache, the server will start a Map/Reduce job to retrieve all keys from clustered nodes and return all keys to the client.
Use this method with caution if there are a large number of keys.
Set keys = remoteCache.keySet();
Set keys = remoteCache.keySet();