We have big issue with caching a lot of data in the custom xml files. Xml files because we have 20-30 instances of application and cache is between these instances.
Problem is when few instances tries to rebuild xml cache at the same time.
Sounds like you need to create some kind of locking mechanism. One of the simplest ways is to simply create a .lock file in alongside the XML file when it is being written to, and then remove it once the write has finished. Then in your code you can check whether the lock is present before writing. and if it is wait. until it is freed.
Caching with Umbraco
Hello Community,
We have big issue with caching a lot of data in the custom xml files. Xml files because we have 20-30 instances of application and cache is between these instances.
Problem is when few instances tries to rebuild xml cache at the same time.
What is the soultion for such problems?
Some ideas would be great !!!
Thanks,
Alex
Sounds like you need to create some kind of locking mechanism. One of the simplest ways is to simply create a .lock file in alongside the XML file when it is being written to, and then remove it once the write has finished. Then in your code you can check whether the lock is present before writing. and if it is wait. until it is freed.
Hi Dan,
Thank you, great idea. We will use it.
is working on a reply...