Multimap Caches with the .NET Client

Tip
The source code for this tutorial is available on GitHub.

This tutorial demonstrates how to use multimap caches to associate multiple values with a single key.

Prerequisites

  • A running Infinispan server.

  • .NET 10 or later.

Running the Example

dotnet run --project multimap

Code Walkthrough

Storing Multiple Values

Use Put to add multiple values under the same key. Each call appends a new value rather than replacing the existing one.

await mmap.Put("2016", "Oihane");
await mmap.Put("2016", "Elaia");

Retrieving All Values

Use Get to retrieve all values associated with a key.

var values = await mmap.Get("2016");

Expected Output

People born in 2016:
  Oihane
  Elaia
  Iker
  Argia

Total people: 7