Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strategy for Ensuring Cached Data is Current
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Strategy for Ensuring Cached Data is Current
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01540720
Message ID:
01540720
Views:
74
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
Next
Reply
Map
View

Click here to load this message in the networking platform