Reputation: 40042
Below is the dataCacheClient
entry in web.config
:
<dataCacheClients>
<dataCacheClient isCompressionEnabled="true" name="default">
<autoDiscover isEnabled="true" identifier="MyRoleName" />
<localCache isEnabled="true" sync="NotificationBased" objectCount="100" ttlValue="3000" />
<clientNotification pollInterval="300" />
<transportProperties maxBufferSize="1073741824" maxBufferPoolSize="1073741824" />
</dataCacheClient>
</dataCacheClients>
The above configuration will use colocated caching on MyRoleName
roles. In addition to colocated caching, I have indicated that I also want to use localCache
. I am still a bit confused about this.
Please could someone validate my assumptions below:
pollInterval
). If there is a difference, then the local cache will invalidate itself until the next colocated read.ttlValue
) which will force a refresh on the next colocated cache read.In role cache settings I have the following configuration:
Thanks
Upvotes: 0
Views: 222
Reputation: 245
Think of local cache as something only for the client. This will give you a clear perspective. You are maintaining a local copy at the client of the objects you frequently/recently use. Client could be anywhere - onPremise, in azure , even in a different deployment. In every x time interval you have mentioned in notification interval, it will poll the server or main cache and see if any notifications are available for objects within the local cache And yes, ttl value is the time to refresh the local cache
Upvotes: 1
Reputation: 368
At first I also was a little confused with how localCache works with co-located caching. But as I realised localCache is required only for dedicated caching, when you have seperate caching server. In this case localCache reduces cache respose time, because it's also stored in all instances memory and is just being synchonized via notifications.
If you use co-located caching, cache is already stored in instances memory, so it's already localCache. It is automatically synchronized between all instances.
Similar like if you have multiple dedicated cache roles you don't have to synchronize data between them.
To be completeley sure I've made a simple test with Azure Emulator. I started it with two instances. And added object to cache at first instance, then checked if it exists at second instance, and it was there.
Upvotes: 1