So I am using AppFabric for Windows Server to be a distributed caching system which will have clusters to form a cache system.
One thing I was reading about in the documentation:
For best performance, only enable local cache for objects that change infrequently. Using local cache for frequently changing data may increase the chance that the client will be working with stale objects. Although you could lower the ttlValue and make a process refresh the local cache more frequently, the increased load on the cluster may outweigh the benefits of having the local cache. In such cases of frequently changing data, it is best to disable local cache and pull data directly from the cluster.
http://msdn.microsoft.com/en-us/library/hh351483(v=azure.10).aspx
Now, since my situation is that objects WILL be changing frequently, how would I access the cache directly rather than through the local cache? This part is not made clear or maybe I am misunderstanding here.
Is there an example of this?
You don't need to do any explicit coding work. The flow is as follows:
so if the objects change/expire frequently, then just disable the local cache (since the overhead of syncing with server increases) and data cache client will always go to the server.
also when the data changes frequently and with local cache enabled, you run the risk of having stale data in your local cache, whereas other data cache clients may have updated the same object on the server.
the local cache is just an additional layer of performance benefits to be leveraged.
you can enable/disable it via code or config.
<localCache
isEnabled="true"
sync="TimeoutBased"
objectCount="100000"
ttlValue="300" />
Via code: http://msdn.microsoft.com/en-us/library/ee790857(v=azure.10).aspx Via config: http://msdn.microsoft.com/en-us/library/ee790880(v=azure.10).aspx