concurrent access
Closed this issue · 5 comments
I've a use-case where I have two applications reading/writing to the disk cache. When reading from the disk cache, an application will first read from the in-memory cache, which in some scenario's will be dirty. Is it possible to always read from the physical disk first?
Attempting to subvert the fscache in this way is almost certainly a bad idea. Rather, have the writers use the lower-level WriteStream method with sync=true. Your disk cache should respect the fsync on subsequent reads. Note that this will (naturally) impact your write throughput...
My issue is that a single disk cache is shared between two applications. One instance of the application can write the disk on cache using the WriteStream method, but the other instance is reading from the diskv's local in-memory cache.
d.cache[key]
And hence, reading a dirty value.
Hmm. Using two diskv processes against the same filesystem path makes me very nervous—I sense a great potential for race conditions. That said, I think it's not dangerous to add this option. See the linked PR, and this usage example (test) specifically. Does it do what you want/expect?
Yes - Thanks.
Closed with #10. Thanks for the request! Be careful! 😟