Method Remove
Remove(ICollection<TKey>)
Removes the element with the specified keys from IDistributedDictionary.
Declaration
int Remove(ICollection<TKey> keys)
Parameters
Type | Name | Description |
---|---|---|
ICollection<TKey> | keys | The keys of the elements to remove. |
Returns
Type | Description |
---|---|
System.Int32 | The number of items that were removed. |
Examples
The following code sample shows how to remove multiple entries in distributed dictionary.
ICache cache = CacheManager.GetCache("myCache");
string dataTypeName = "DistributedDictionary";
IDistributedDictionary<string, Product> dictionary = cache.DataTypeManager.GetDictionary<string, Product>(dataTypeName);
// Create list of keys to remove
List<string> keysToRemove = FetchExpiredProducts();
int itemsRemoved = dictionary.Remove(keysToRemove);