Method GetCacheItemBulk
GetCacheItemBulk(IEnumerable<String>, ReadThruOptions)
Retrieves the specified CacheItems from the Cache object. This overload also allows specifying the read-through option. If read-through is set and the object does not exist in the cache, the object will be fetched from the data source and added to the cache.
Declaration
IDictionary<string, CacheItem> GetCacheItemBulk(IEnumerable<string> keys, ReadThruOptions readThruOptions = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | keys | IEnumerable list of unique identifier for the cache items to be retrieved. |
ReadThruOptions | readThruOptions | ReadThruOptions regarding reading from data source. It can be either ReadThru, ReadThruForced or None. |
Returns
Type | Description |
---|---|
IDictionary<System.String, CacheItem> | The retrieved cache items as key-value pairs. |
Examples
Example demonstrates how to retrieve the cache items with read thru option.
ICache cache = CacheManager.GetCache("demoClusteredCache");
List<string> keys = new List<string>()
{
"Product0",
"Product1",
"Product2"
};
ReadThruOptions readThruOptions = new ReadThruOptions(ReadMode.ReadThru);
IDictionary<string, CacheItem> items = cache.GetCacheItemBulk(keys, readThruOptions);