Add array of CacheItem to the cache.

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


public override IDictionary AddBulk(
	string[] keys,
	CacheItem[] items,
	DSWriteOption dsWriteOptions,
	DataSourceItemsAddedCallback onDataSourceItemsAdded
Visual Basic
Public Overrides Function AddBulk ( 
	keys As String(),
	items As CacheItem(),
	dsWriteOptions As DSWriteOption,
	onDataSourceItemsAdded As DataSourceItemsAddedCallback
) As IDictionary
Visual C++
virtual IDictionary^ AddBulk(
	array<String^>^ keys, 
	array<CacheItem^>^ items, 
	DSWriteOption dsWriteOptions, 
	DataSourceItemsAddedCallback^ onDataSourceItemsAdded
) override


Type: array<System..::..String>[]()[][]
The cache keys used to reference the items.
Type: array<Alachisoft.NCache.Web.Caching..::..CacheItem>[]()[][]
The items that are to be stored
Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating data source
Type: Alachisoft.NCache.Web.Caching..::..DataSourceItemsAddedCallback

Return Value

Type: IDictionary
keys that are added or that alredy exists in the cache and their status.


If CacheItem contains invalid values the related exception is thrown. See CacheItem for invalid property values and related exceptions


The following example demonstrates how to add items to the cache with an absolute expiration defined by a variable d, a sliding expiration defined by a variable t, a priority of high, and that notifies the application when the item is removed from the cache. First create a CacheItems.
 Copy imageCopy
string keys = {"ORD_23", "ORD_67"};
CacheItem items = new CacheItem[2]
items[0] = new CacheItem(new Order());
items[0].AbsoluteExpiration = d;
items[0].SlidingExpiration = t;
items[0].Priority = CacheItemPriority.High;
items[0].ItemRemoveCallback = onRemove;

items[1] = new CacheItem(new Order());
items[1].AbsoluteExpiration = d;
items[1].SlidingExpiration = t;
items[1].Priority = CacheItemPriority.Low;
items[1].ItemRemoveCallback = onRemove;
Then add CacheItem to the cache
 Copy imageCopy
NCache.Cache.Add(keys, items, "Customer", "Orders");

Cache.Add(keys, items, "Customer", "Orders");

See Also