Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3364
| From | Simon <bad@example.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Test race condition? (unit test?) |
| Date | 2011-10-10 15:48 +0200 |
| Message-ID | <9fgbe9Fu9aU1@mid.individual.net> (permalink) |
| References | <9ffnu3Fpb9U1@mid.individual.net> <j6uos6$kh0$1@dont-email.me> |
> > The real question here is - what is the problem you're trying to > resolve. Without knowing that, it's difficult to recommend if there is a > better way. > Thanks for the reply. I am not trying to solve a problem per say. I am 'just' trying to prevent duplicate work. When a request for a certain page first comes, it make a few calls to the db and then caches the page. Once the page is cached, only one call needs to be made. But I sometime get hundreds of calls for a certain page, all at the same time. So it would make no sense for all of them to create the very same cache page. It makes more sense for the first request to cache the page wile others wait a few milliseconds for it. By locking the page, the first requests is instructing others that the work is already been done and they should wait a few milliseconds. Every so often, (for various reasons), the cache is marked as 'dirty' and a new cache will then be recreated. If one request 'locks' the page, and a cache is available, then the other requests will continue to serve the dirty page. I just want to prevent the same cache been created by many requests at the same time. I hope this makes sense. Simon
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Test race condition? (unit test?) Simon <bad@example.com> - 2011-10-10 10:16 +0200
Re: Test race condition? (unit test?) Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 08:36 -0400
Re: Test race condition? (unit test?) Simon <bad@example.com> - 2011-10-10 15:48 +0200
Re: Test race condition? (unit test?) The Natural Philosopher <tnp@invalid.invalid> - 2011-10-10 15:43 +0100
Re: Test race condition? (unit test?) Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 13:42 -0400
csiph-web