Retrieving a Collection from Cache
For fetching a collection from cache, use the GetBulk method. This method returns the collection of items.
string[] keys = { "Product:1001", "Product:1002" };
try
{
IDictionary items = cache.GetBulk(keys);
if (items.Count > 0)
{
IEnumerator iter = items.Values.GetEnumerator();
while (iter.MoveNext())
{
Product info = (Product)iter.Current;
// Do something
}
}
}
catch (OperationFailedException ex)
{
// Handle exception
}