I am using TvdbLib in a program. This library can use a cache for loading TV series quicker. To further improve the speed of the program, I do all my loading of TV series on separate threads. When two threads run simultaneously and try to read/write from the cache simultaneously, I will get the following error:
The process cannot access the file
‘C:\BinaryCache\79349\series_79349.ser’ because it is being used by
another process.
Does anyone know how to avoid this and still have the program running smoothly?
CacheProvideris not built for being used in multi-threaded scenarios… either use it in one thread only orlockon every access via a sharedobjector supply every thread with its ownCacheProviderand its own distinct_rootdirectory (in the constructor).