Im wondering if theres a possibility to do an "in between" write to the cache while im having a lock on it.
The Scenario is that im creating a cache entry and while doing that im retrieving a lot of data from external interfaces which can take quite some time. So what i want to do is to write an empty object in the cache and then some updates in between because i have some other functions which are only reading which could then suceed already.
So basically i want to lock the cache, and then do like 2 writes while having the lock and working on the object, so a reading function can already return some information if available and does not have to wait till the whole process is done and the lock is realesed and the entry is finally written to the cache...
But still i dont want to loose the lock because otherwise it could be modified. I hope it makes sense as i describe it. Is there any possibility to really write to the cache when having a lock so a read would succeed and deliver that written data even if the lock is still ongoing?