Table of Contents

Method Add

Namespace
Scaleout.Client
Assembly
Scaleout.Client.dll

Add(TKey, TValue, CreatePolicy, IEnumerable<string>, CancellationToken)

Adds an object in the cache.

public CacheResponse<TKey, TValue> Add(TKey key, TValue value, CreatePolicy createPolicy = null, IEnumerable<string> tags = null, CancellationToken cancellationToken = default)

Parameters

key TKey

Identifier of the object in the cache.

value TValue

Value to be stored in the cache.

createPolicy CreatePolicy

The policy to be associated with the new object. If null, the default policy for the cache will be used.

tags IEnumerable<string>

Collection of tags to associate with the object. Pass null for no tags.

cancellationToken CancellationToken

A token used to propagate notification that this operation should be canceled.

Returns

CacheResponse<TKey, TValue>

A CacheResponse<TKey, TValue> containing the outcome of the operation.

Remarks

The Result property of the response will contain one of the following ServerResult outcomes:

ServerResultDescription
AddedA new object was successfully added in the ScaleOut service.
AlreadyExistsError The object could not be added because another object with the same key already exists in the ScaleOut service.