Add the object to the cache asynchronously.

Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.3.0.0 (4.3.0.0)

Syntax

C#
public virtual void AddAsync(
	string key,
	Object value,
	AsyncItemAddedCallback onAsyncItemAddCallback,
	string group,
	string subGroup
)
Visual Basic
Public Overridable Sub AddAsync ( 
	key As String,
	value As Object,
	onAsyncItemAddCallback As AsyncItemAddedCallback,
	group As String,
	subGroup As String
)
Visual C++
public:
virtual void AddAsync(
	String^ key, 
	Object^ value, 
	AsyncItemAddedCallback^ onAsyncItemAddCallback, 
	String^ group, 
	String^ subGroup
)

Parameters

key
Type: System..::..String
The cache key used to reference the item.
value
Type: System..::..Object
The value that is to be stored
onAsyncItemAddCallback
Type: Alachisoft.NCache.Web.Caching..::..AsyncItemAddedCallback
A delegate that, if provided, is called to inform about the status of the operation.
group
Type: System..::..String
The data group of the item
subGroup
Type: System..::..String
The subGroup of the item

Examples

The following example demonstrates how to add an object to the cache with group, subGroup and a delegate that notifies the application about the operation status. First create the AsyncItemAddedCallback.
 Copy imageCopy
AsyncItemAddedCallback asyncItemAdded = new AsyncItemAddedCallback(OnAsyncItemAdded);

OnAsyncItemAdded(string key, object result)
{
...
}
Then add the object to the cache.
 Copy imageCopy
Cache cache = NCache.InitializeCache("myCache");
   cache.AddAsync("timestamp", timestamp, asyncItemAdded, "group-name", "subGroup-name");

See Also