Here's a simplified example of our current caching strategy:
Assume products table with Onhand field (a cached field because it's not practical to calculate sum of total purchased-total sold).
At any time, buyers can place order for product A
Pseudo-code:
Web Process 1 starts processing order for Product A from Buyer Y
Web Process 2 starts processing order for Product A from Buyer Z
at this time both Process 1 and Process 2 see there are 4 onhand
So they both simultaneously submit an update
Update products onhand=3 where product=A
(The actual real world application is much more complex so I can't just issue 'update products set onhand=onhand-1 where product=A')
I'm looking to use Semaphore Locking, but I wanted to check with the gurus here for any other strategies I should consider for ensuring the cache is up-to-date.
Brandon Harker
Sebae Data Solutions