I have implemented OutputCache in an application and it works fine, but since I have specified the location as server, and the applications runs in server farm (2 servers) , when I clear the cache, it clears only from one server at one time. I have thought about specifying a server location (hardcode), so that the cache will be stored at one place and can be easily cleared when I have to. So, is there any way to hardcode server name for the location attribute in OutputCache? Or from webconfig file?
Declaration in webconfig
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="Cache10Minutes"
duration="300"
location="Server"
varyByParam="none"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
Definition in related page (page header)
<%@ OutputCache CacheProfile="Cache10Minutes" Duration="300" Location="Server" VaryByParam="none"%>
To clear cache on button click
HttpRuntime.UnloadAppDomain()
Or what about creating a trigger from database on update from client. Can this clear cache from both the servers? Correct me if my idea is wrong or not clear enough, I'm confused. Please advice.