Method GetBulk
GetBulk<T>(IEnumerable<String>, ReadThruOptions)
Retrieves the objects from cache for the given keys as key-value pairs. Options regarding reading from data source (read-through) can be set.
Declaration
IDictionary<string, T> GetBulk<T>(IEnumerable<string> keys, ReadThruOptions readThruOptions = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | keys | The keys against which items are to be fetched from cache. |
ReadThruOptions | readThruOptions | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or None. |
Returns
Type | Description |
---|---|
IDictionary<System.String, T> | The retrieved cache items as key-value pairs. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of value obtained from the cache. |
Examples
Example demonstrates how to retrieve the value cached against multiple keys with Read through Options.
ICache cache = CacheManager.GetCache("demoClusteredCache");
List<string> keys = new List<string>()
{
"Product0",
"Product1",
"Product2"
};
ReadThruOptions readThruOptions = new ReadThruOptions(ReadMode.ReadThru);
IDictionary<string, Product> items = cache.GetBulk<Product>(keys, readThruOptions);