ThinkGeo.com    |     Documentation    |     Premium Support

TemporaryCacheDirectory

Hello,


I recently built my project and deployed it on another PC for testing purposes. On the mock-production machine I am not getting any of the caching features. In fact, it is behaving almost as if the cache has been disabled entirely. I do not set the directory in code at any time. This has always worked ok for me as I see in the properties it is set to a temp directory under my user folder. Is this carrying over during the compile or will it always be the running users temp directory???


What else would be causing this type of behavior if not that?


Thanks,


Nelson



Nelson, 
  
 What I experienced is that the cache folder is set by VS designer because MS is serializing it (at least in 3.0.307) 
 The result is that the cache folder is probably set to c:\users\nelson…\temp 
 this folder may not exists in the mock production machine. 
  
 I worked around this by forcing the temp folder to Path.GetTemporaryFolder () … 
  
 I also noticed that if you are using multiple projections, then the projected tiles get mixed in the temporary folder. 
 I worked around this by setting the temp folder to Path.GetTemporaryFolder ()/projection.tostring(); 
  
 I’m not sure if the issue is still there … however my workaround code is still there and it works. 
  
 Patrick. 


That sounds a lot like what I thought was happening. Just didn’t want to code around if it it wouldn’t have made a difference. I’ll give that a shot. Thanks, Patrick.

Patrick, 
  
   I see how you are working around it but that was not the intended way.  The caching was designed to be transparent to you.  When you change anything on an overlay which includes changing layers underneath you are supposed to call the Overlay.Lock.EnterWriteLock and when you are finished updating your projection but before you refresh you call the ExitWriteLock.  Then when you call the next refresh we will create a new temporary cache directory so the old and new projections will not get mixed.  If you do not want to call the lock for whatever reason you can also set the Overlay.Lock.IsDirty flag to true and then call the refresh.  They will accomplish the same thing.  The only downside to the IsDirty set directly is that we may be drawing on another thread at the time you set the projection and we cannot guarantee you will not get an exception that is threading related.  When you use the locking system it will prevent things like this from happening. 
  
 David

Setting the temporary cache directory on load did not work. In development my cache is working; Production builds do not work correctly and sometimes odd errors will occur with a red x in the map viewer. Any ideas why this might be?.

Actually, and strangely, the production versions cache system does not seem to be working on my development machine either so I can probably rule out the TempDirectory as being the issue… Also, when zooming in or out or panning, the map will turn white as if caching is off, but no map will ever draw unless I explicitly force a refresh of my map… Fine in development though… Thoughts are appreciated. Thanks.

David, 
  
 Ok, that works in 3.0.353. 
  
 However, the issue is easy to understand; we have undred of thousand of code lines here (initialy wrote for MS2) and this was working perfectly until you set this lock/unlock feature. 
  
 In a preexisting code it’s very difficult to place every lock/unlock without forgetting some. 
  
 I would like to have a mode where and execption is raised if the lock is not set; this would help us a lot … 
  
 Patrick.

Posted By Nelson on 07-23-2009 07:27 AM 

Actually, and strangely, the production versions cache system does not seem to be working on my development machine either so I can probably rule out the TempDirectory as being the issue… Also, when zooming in or out or panning, the map will turn white as if caching is off, but no map will ever draw unless I explicitly force a refresh of my map… Fine in development though… Thoughts are appreciated. Thanks. 

Nelson,
 
I am wondering what you are trying to say is the “automatic cache system” cannot work in your production version?
 
If so, I want to explain that every time you restart your application, your caches tiles generated before will be discarded, so when you run your production app even on your development machine, the cached tiles has to be generated again.
 
Let me know if I am not clear enough or any more questions.
 
Thanks.
 
Yale





 



Posted By Nelson on 07-23-2009 06:45 AM 

Setting the temporary cache directory on load did not work. In development my cache is working; Production builds do not work correctly and sometimes odd errors will occur with a red x in the map viewer. Any ideas why this might be?. 

Nelson,
 
Are you using GoogleOverlay or VELayer? If so, you can try the latest public version (3.0.362) to remove this ODD tile missing problem.
 
Let me know if I am not clear enough or any more questions.
 
Thanks.
 
Yale





 



By automatic cache system, I mean the built in caching system that is new to RC1. The one you described above.  
  
 Yes, I realize this caches or per application session, so once the application is restarted so to a new cache is made. That is not what I mean. 
  
 The best way to describe what I mean is to have you disable caching on a layer. Notice how the screen disappears every time you do an action? Zoom. Pan. The screen dissapears but eventually comes back. That is because caching is disabled, I assume. 
  
 Well that is what is happening to the built application running on my same development machine. When running the application from within Visual Studio, the application performs as expected / intended. When building an installation of the application and then installing it to my machine and loading the EXE, it behaves as if the cache has been disabled, except for one huge difference; The map never redraws!  
  
 It will redraw if I force a refresh with my refresh button, but this does not make much sense… I thought maybe the application was compiling with a hardcoded version of the TempCacheDirectory pointing to my user folder so to verify if that may be the case I ran the application on my development PC expecting the cache to then work. It did not. And the map does not redraw without forcing it to. But the development version works correctly…

Nelson,


Thanks for your post!
 
I will clarify 2 things before making sure what is your problem,  I am sorry I still cannot make myself understood 100% of your problem.
 
1)      If you disable the local cache, every time the current extent changes, the screen will disappear and eventually it will comes back after it is drawn.
 
2)      Every time you changed the extent to some “cached extent” and you want to redraw it instead of using the tiles from the cache. You have to write lock the overlay to discard the tiles.
 
So you problem is: Under one machine (32 bit), your application is developed and runs as expected with out turning off the local cache system. Then you run the exe of the application, it will behaves the caches disabled?
 
We have some HowDoI samples, can you build and run the exe to see its behaviors are expected or not?


I think this only happened at the first restart of the exe started, because as we known, the tiles will be discarded every time you restart the machine.
 
I am sorry for my understanding.
 
Let me know if you have any more questions.
 
Thanks.
 
Yale

The issue is actually inregards to the fact I wasn’t overwriting my installed version of MapSuite with any interim DLL’s. So, when I applied the Merge Module from the interim folder, it must always look in the installed folder C:\program files\thinkgeo\etc so it was building my project with the wrong files Ii’m assuming. swapping the install folder files with the 341 build seemed to clear up the issue.

Nelson, 
  
 Thanks for letting me know this! 
  
 Any more questions just let me know. 
  
 Thanks. 
  
 Yale