Infinispan.Hotrod.Core 0.0.3
.NET Core client for Infinispan Hotrod Protocol

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:

  1. 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>
  2. Create a cluster
    // Use a non-authenticated non-encrypted cluster;
    dg.AddHost("127.0.0.1", 11222);
    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.
  3. Create a cache
    var cache = dg.NewCache<string, string>(new StringMarshaller(), new StringMarshaller(), "default");
    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.
  4. 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";
// Use a non-authenticated non-encrypted cluster;
dg.AddHost("127.0.0.1", 11222);
var cache = dg.NewCache<string, string>(new StringMarshaller(), new StringMarshaller(), "default");
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);
}
}
}
Definition: Cache.cs:10
Definition: Cache.cs:10
Definition: Cache.cs:10

Cluster configuration

The following are cluster wide settings.

Connection properties

Cluster topology