Mutex page operations

R

Richard Hollis

I have a site which is using caching for some frequently used pages. When
the page-level cache expires, or is expired by me, the page will get
re-rendered to a static HTML file and then shown to the user, after it has
been rendered.

Assume the cache is stale. Somebody comes along and requests the page. It
will then get re-generated, but whilst this is happening, if somebody comes
along and requests the page again then they can get an error because the
static HTML page file is still being recreated by the previous page request.

What I think I need is a mutex for the page to stop this from happening,
for the second page request, during cache refresh. So: 1st request owns the
mutex until finished, and, whilst it's updating, all other page requests
wait on the mutex.

How can I implement a 'mutex' style operation for this scenario in ASP or
handle it better to avoid this situation from happening? I've got my code
able to understand if the page being requested is actually being updated, so
I could just redirect the client back to the same script again, but at the
same time the update process itself takes less than a second, so if the page
could somehow wait for the operation to complete it would be a cleaner
operation. I tried wrapping the Sleep API in a COM object, but this didn't
seem to work and I'm just looking for a bit of a sanity check on the best
way to go about this.

Thanks
Richard
 
R

Richard Hollis

Solution: SleepEx API in wrapper COM object and a short wait time, with a
timeout period inside the ASP include script. Sleep API won't work for some
reason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Mutex 4
Mutex 1
What in C++11 prohibits mutex operations from being reordered? 68
Distributed Reader-Writer Mutex 1.0 4
Mutex object 2
mutex 2
Global Mutex? 6
CAS operations and scalability... 1

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top