Add the object to the cache asynchronously.
Namespace: Alachisoft.NCache.Web.CachingAssembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)
Syntax
C# |
---|
public Object AddAsync( string key, Object value, AsyncItemAddedCallback onAsyncItemAddCallback, string group, string subGroup ) |
Visual Basic |
---|
Public Function AddAsync ( _ key As String, _ value As Object, _ onAsyncItemAddCallback As AsyncItemAddedCallback, _ group As String, _ subGroup As String _ ) As Object |
Visual C++ |
---|
public: Object^ 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.
Then add the object to the cache.
CopyC#
AsyncItemAddedCallback asyncItemAdded = new AsyncItemAddedCallback(OnAsyncItemAdded); OnAsyncItemAdded(string key, object result) { ... }
CopyC#
Cache cache = NCache.InitializeCache("myCache"); cache.AddAsync("timestamp", timestamp, asyncItemAdded, "group-name", "subGroup-name");