This package allows the user application to perform operation on a remote Infinispan cluster via the Hotrod protocol.
The main use case is the following:
- import this package in the project description
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Infinispan.Hotrod.Core" Version="*-*" />
</ItemGroup>
</Project>
- Create a cluster
InfinispanDG class describes an Infinispan Cluster and is the main API entry point.
Definition: InfinispanDG.cs:18
InfinispanHost AddHost(string host, int port=11222)
Add a cluster node to the initial list of nodes for the DEFAULT_CLUSTER.
Definition: InfinispanDG.cs:84
The InfinispanDG class allows several cluster configuration: tls, authentication, nodes address setup, clusters for failover. See below.
- Create a cache
An untility Marshaller that works on strings using ASCII encoding by default
Definition: Marshaller.cs:27
A Cache object allows to execute operation on remote cluster. To create a cache object a marshaller for both key and value must be provided. See Marshaller.
- Write application code
await cache.Put(myKey, "some value");
string result = await cache.Get(myKey);
Console.WriteLine("Getting my entry with key {0} from the cache. Result value is: {1}", myKey, result);
A full working example with a basic put/get session:
using System;
using System.Threading.Tasks;
namespace Infinispan.Hotrod.Application
{
class Program
{
static async Task Main(string[] args)
{
var myKey = "myKey";
await cache.Put(myKey, "some value");
string result = await cache.Get(myKey);
Console.WriteLine("Getting my entry with key {0} from the cache. Result value is: {1}", myKey, result);
}
}
}
Cluster configuration
The following are cluster wide settings.
Connection properties
Cluster topology