I am trying to use AppFabric for fasten my image retrieval from SQL Database. I created my provider file and load it to my cache. However, I am struggling right now.
How can I call get function from cache using my provider file or do I need to use my provider file while retrieving data?
When I call .Get(key.Key), do I need to see the data coming from my database?
My Read method from provider is as follows, is this correct?
public override DataCacheItem Read(DataCacheItemKey key)
{
try
{
Object retrievedValue = null;
DataCacheItem cacheItem;
retrievedValue = *Running SQL Query Retrieving Image from DB*;//Is that a correct approach?
if (retrievedValue == null)
cacheItem = null;
else
cacheItem = DataCacheItemFactory.GetCacheItem(key, cacheName, retrievedValue, null);
return cacheItem;
}
catch
{
return null;
}
}
DataCacheItemFactory.GetCacheItem
– stuartd