Click to See Complete Forum and Search --> : Application variables gone mad


cusimar9
01-11-2007, 10:32 AM
I use application variables a lot on my websites to cache frequently used data

I've just noticed an incredibly odd thing

When I cache the data (once every hour) I use something like this:


Application.Lock

' Cache all data

Application("Data_Updated") = Now()
Application.UnLock


Now one of my pages was showing some strange results, so I added the following line at the top:


response.write("Application("Data_Updated"))


And every time I hit F5 it alternates between two times! i.e.

11/01/2007 16:29:04 and
11/01/2007 16:00:51

Can someone please shed some light on this because as far as I know a variable can only hold one value at a time

russell
01-11-2007, 12:14 PM
what happens if u put

Response.ExpiresAbsolute = Date()-1

at the top of the script?

cusimar9
01-11-2007, 02:22 PM
OK so now my code reads:


Response.ExpiresAbsolute = Date()-1
response.write("Application("Data_Updated"))


And its still doing it. Its so strange, it only seems to swap between the last 2 versions that were cached. So if I cache it 3 times in a row, it'll only swap between the last two times. Its crazy!

Is there any way I can force it to clear all Application variables?

I even set all the Application variables to blank, before I re-set them, and it still stores 2 versions...

cusimar9
01-11-2007, 03:50 PM
Removed

russell
01-11-2007, 05:06 PM
works ok when i test it.

what are your browser cache settings?

cusimar9
01-12-2007, 02:55 AM
OK I've just tried that test.asp webpage at work and that does seem to be working ok now, but my original problem remains.

Its definitely NOT down to the browser caching, its the ASP. All the Ctrl+F5's in the world don't change a thing. Plus I've tried it on about 3 different computers, its definitely something else. The ASP seems to be storing the 2 latest versions of the application variables.