appfabricappfabric-cache

AppFabric LocalCache - Least Used Eviction


If I am caching something in local cache and using it on a regular basis does the distributed cache know that the local cache is using it?

The reason I ask this is because the distributed cache has a Least Used Eviction policy. If I am not using it from distributed cache and the distributed cache doesn't know I am using it then it will be evicted at some stage.

This is a large piece of data that rarely changes so I will cache it for a long period of time. I don't want to have to drag 2 or 3 MG across the wire more often than I have to based on it being evicted from the Distributed Cache on a least used basis.

Hence my question - does the distributed cache have knowledge that it is being used and therefore not evict it as least used?


Solution

  • Interesting.

    The documentation says that when an object is requested from the cache, if it exists in the local cache then

    the reference to the object is returned immediately without contacting the server
    (MSDN)

    in which case, the remote cache cannot possibly be notified that the object is being used, and this would seem to support your thought that the object could become a candidate for eviction.

    There's some discussion here that suggests the local cache also uses an LRU algorithm, and I'd be interested to know whether the two caches do any communication/synchronisation of their LRU timings.