At 06:08 AM 10/12/2004, Ryan Heath wrote >Frans Bouma wrote: >> If a page cache invalidates, the first request will hit the db, >> the second will get the cached version. > >Yep, sure, but this implies a locking mechanism on the cache / >cacheItem / cacheKey. >Anyone ideas how to do this in VB6? I rather not want to lock the >cache itself, for I think that would give bad performance, since other >pages that need the cache must wait for the cache to come available... > >// Ryan
This is where the ReaderWriterLock concept is appropriate -- if you have significantly more reads than writes, you (a) let readers read without blocking other readers; (b) force writers to wait until there are no active readers (or other writers); (c) force readers to wait when there's a writer either waiting (for readers to finish, or for another writer that got there first) or actually using the resource. Unfortunately it seems that the .NET 1.x implementation of the RWLock is rather inefficient. However, the concept is quite useful. J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
