Cache Administration with the .NET Client

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

This tutorial demonstrates how to manage caches using the administration API of the .NET Hot Rod client.

Prerequisites

  • A running Infinispan server.

  • .NET 10 or later.

Running the Example

dotnet run --project cache-admin

Code Walkthrough

Creating a Simple Cache

Create a cache with default settings using CreateCache.

await admin.CreateCache("SimpleCache");

Creating a Cache with XML Configuration

Use GetOrCreateCache with an XML configuration string to create a cache with specific settings like locking, transactions, and expiration.

await admin.GetOrCreateCache("withConfig", cacheConfig);

Listing Cache Names

Retrieve the names of all caches on the server.

var names = await admin.GetCacheNames();

Expected Output

SimpleCache created.
Cache with XML configuration exists or is created.
Caches: SimpleCache, withConfig, ...
Caches removed.