ThinkGeo.com    |     Documentation    |     Premium Support

ClientCache

I am building a site where the majority of it's layers can be toggled on and off via a sidebar. I am interested in utilizing ClientCache if possible.


I noticed that you can specify a CacheID in order to differentiate targets. I am wondering if I can dynamically generate different CacheID's based on various combinations of layers. By constantly changing the CacheID of the same StaticOverlay, am I invalidating the cache and hence dumping what was already cached?


When doing this, I seem to gain no performance. Actually, I am not seeing much performance increase at all..


Edit: When trying to utilize ServerSide cache, I do receive a noticable increase but my server cache directory continues to stay empty. The cache directory is set as


"~/ServerCache"


Edit #2: Actually, with the above referenced directory in regards to server cache, my caches are being saved to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. 



Nelson, 
  
 I’m interesting on how you generate the cacheIds.  For example I have 3 layers (let’s say, a,b,c) in the StaticOverlay, that means I have 7 combinations(a, b, c, ab, ac, bc, abc) and I will have 7 different CacheIds for all of them, right? Further more,  If I have 10 layers, I will have 1023 combinations and accordingly, 1023 cacheIds for that.  
  
 If your cacheId is generated in that way, I think that should work. There is a good tool “HttpWatch” can help you to debug, to see when opening a web page, if the pics are from the remote server, or from the local cache.  
  
 About your second question, I think what you really want is the code like following.  
  
 
Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ServerCache");
 
  
 MapPath() converts the virtual path to absolute physical path, using that the cache images will be put under your website folder instead of C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. 
  
 Ben 


Nelson,


Just let you know if you are interested, please have a look at the client cache white paper here .


Ben.



I thought I had responded to this but the post seems to not have gone through. Basically I iterate through the active layers and use their names concatonated as the cache id. MapPath works like a charm, thank you.

That’s great, let me know for any other queries.