Inserts an object into the Cache asynchronously with dependencies, expiration and priority policies, and a delegate you can use to notify your application when the inserted item is removed from the Cache.

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


public void InsertAsync(
	string key,
	Object value,
	AsyncItemUpdatedCallback onAsyncItemUpdateCallback,
	string group,
	string subGroup
Visual Basic
Public Sub InsertAsync ( _
	key As String, _
	value As Object, _
	onAsyncItemUpdateCallback As AsyncItemUpdatedCallback, _
	group As String, _
	subGroup As String _
Visual C++
void InsertAsync(
	String^ key, 
	Object^ value, 
	AsyncItemUpdatedCallback^ onAsyncItemUpdateCallback, 
	String^ group, 
	String^ subGroup


Type: System..::..String
The cache key used to reference the item.
Type: System..::..Object
The item to be added to the cache.
Type: Alachisoft.NCache.Web.Caching..::..AsyncItemUpdatedCallback
A delegate that can be used to get the result of the Asynchronous update operation.
Type: System..::..String
An string that logically groups the data togehter.
Type: System..::..String
The name of the subGroup within the group.


This is similar to Insert(String, Object) except that the operation is performed asynchronously. A ItemUpdated event is fired upon successful completion of this method.It is not possible to determine if the actual operation has failed, therefore use this operation for the cases when it does not matter much.

Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception incase of failure.


The following example demonstrates how to insert an item into the cache asynchronously with associated group and subGroup. It also registers a delegate to get the result of the asynchronous operation. it into your application's Cache object.
Cache cache = NCache.InitializeCache("myCache");
cache.InsertAsync("DSN", connectionString, new AsyncItemUpdatedCallback(onAsyncItemUpdated), "group-name", "subGroup-name");


System..::..ArgumentNullExceptionkey or value contains a null reference (Nothing in Visual Basic).
System..::..ArgumentExceptionkey or value is not serializable.

See Also