(1) I'm wondering if I use Regions in my AppFabric Caching is it possible for the Regions to exist on the local cache? Or do regions only exist on the cluster?
(2) As a separate question how can I tell if my data is coming from the Cluster or from my local cache? Is there some kind of AppFabric tool that I can use to analyse where the data is coming from?
I am using configuration in code to set up my local cache properties to put my items in to local cache like so
localCacheConfig = new DataCacheLocalCacheProperties(10000, localTimeout, DataCacheLocalCacheInvalidationPolicy.TimeoutBased);
// Setup the DataCacheFactory configuration.
DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
factoryConfig.Servers = servers;
factoryConfig.LocalCacheProperties = localCacheConfig;
//code to put items in cache....etc
Do I need to do anything special on the 'Get' or is it smart enough to get it from local cache if it exists there?
Region is a logical concept in AppFabric. It will allow you to query items by tag, but items will be stored in only one host (limited distribution and high availability too).
Local cache is not bound to region. it's just a local copy of your latest call to the cache cluster. Local cache is enabled on client side, meaning that you can avoid it if you want.
The lifetime of an object in the local cache is dependent on several factors, such as the maximum number of objects in the local cache and the invalidation policy (timeout or notification).
You cannot know is data is coming from local cache or distributed cache. That's why local cache is recommended for reference data.