ScaleOut Client Library for .NET
Welcome to the ScaleOut Client Library for .NET, an API for accessing servers in ScaleOut Software's family of in-memory computing products. In this documentation you will find:
Installation
The Scaleout.Client NuGet package is available for download on nuget.org. To install from the Package Manager Console, you can run:
Install-Package Scaleout.Client
Basic Configuration
The Configuration section in this guide goes into detail about how to configure your application to connect to a ScaleOut in-memory data grid and set cache policies.
A quick, minimal configuration that uses default policies would only consist of a connection string (typically stored in a config file). See Connecting to a ScaleOut Data Grid to learn more about connection strings.
Tip
The CacheBuilder<TKey, TValue> allows you to specify a number of cache policies, both at runtime and through configuration files. See Configuration for details.
Basic Usage
- Use Connect(String) or ConnectAsync(String) to connect to the ScaleOut in-memory data grid.
- Use a CacheBuilder<TKey, TValue> to configure and build an instance of the Cache<TKey, TValue> class.
- Use the Cache instance to access objects in the ScaleOut distributed in-memory data grid.
- Most cache methods that access objects return a CacheResponse<TKey, TValue>. Check the response to verify the outcome of the operation.
using System;
using System.Threading.Tasks;
using Scaleout.Client;
class Program
{
public static async Task Main()
{
// Connect to the ScaleOut service (in this case, one host running locally):
var conn = await GridConnection.ConnectAsync("bootstrapGateways=localhost:721");
// Configure and build a Cache instance:
var builder = new CacheBuilder<string, string>("My cache", conn);
builder.SetObjectTimeout(TimeSpan.FromMinutes(20), TimeoutType.Absolute);
var cache = builder.Build();
// Add an object to the ScaleOut data grid:
var response = await cache.AddAsync("key1", "object value");
if (response.Result == ServerResult.Added)
Console.WriteLine("Object created.");
}
}