pottery
pottery copied to clipboard
Reader Writer
There is some reader writer problems when you develope a web application, for example a django application witch sells tickets and the problem become more complicated when you need to add cache to your application.
user_A request for available tickets user_B changer available tickets, but user_B's response posts first and empty dirty cache but user_A' response old data will dirty cache while caching the response data.
I like to have some reader writer function or decorator to stop multiple writers or a writer and a reader executing webservice+cache to stop such problems to take place.
it can be implemented by locks a counter.
I think there is 2 policies to face this on reader writer problem wait for readers to stop then let the writer do his job or don't let readers go in while there is a writer waiting or executing.