473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Mutex page operations

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
Jul 22 '05 #1
1 1370
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.

"Richard Hollis" <ri************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Srijit Kumar Bhadra | last post by:
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with...
1
by: Rocky | last post by:
I am using the following piece of code to ensure that my application only runs once, however I have a few questions about it. static Mutex m_Mutex; << in c# I assume that when the methods are...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
4
by: TGOS | last post by:
I was thinking about it for a while, a mutex written in C and without disabling any interrupts. Is it possible? typdef struct mutex { unsigned int owner1; unsigend int owner2; } *mutex; ...
2
by: Martin Maat | last post by:
Hi. I want to use the same mutex in different classes (web pages in an ASP.NET application). In global.asax.cs, the class that starts up first, I create a Mutex like this: static private...
20
by: Michael A. Covington | last post by:
See: http://www.ai.uga.edu/mc/SingleInstance.html While attempting to use a mutex to allow only one instance of my app to run at a time (Recipe 4.12 in C# Programmer's Cookbook), I found that if...
2
by: William LaMartin | last post by:
I posted this in the ASP.net newsgroup with no response, so I will try it here: What needs to be changes to make this work? It is on a Windows 2003 shared server. This code: Private...
4
by: m_palmer45 | last post by:
Hi, I was looking at the code in the standard lib's mutex.py, which is used for queuing function calls. Here is how it lets you acquire a lock: def testandset(self): """Atomic test-and-set --...
4
by: google | last post by:
Hi Guys, I'm having a bizarre problem here with mutexes. If I have the following code in a page (note that it never releases the mutex!), then load the page twice, in 2 seperate browsers, I do...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.