Hi Paul,
Thanks for your elaborate reply.
I am actually doing a study on different caching pattern which can be adopted in different locking scenarios like in optimistic locking ,pessimistic.
Let me make it more clear.
I wish to know that if an application is using optimistic concurrency as the base, how should i implement the cache ,if we can't tolerate stale data at all and if we can tolerate stale data but only for some seconds.
In this case i need to know all the aspects of putting the cache in place like
1. At what moment of time should we invalidate the cache like at the start of transaction , just before updating the database or any other time
2 When should we lock the cache
3. how should we overcome the data retrieval latency issue which ultimately lead to stale data for some time in cache
4. if a thread is making some changes in a data in database how can we make sure that cache gets refreshed for the other thread to get fresh value.
5. Should we update the cache inside the transaction or after completion of transaction (in both scenarios of wanting and not wanting stale data)
6.If one thread is reading or writing a value to cache, how to block other threads to access that cache object.
Similarly for pessimistic concurrency
Hope i am able to clarify my query
It would indeed take some of your time but i would really appreciate if you can give your inputs on the above
regards |