View Full Version : Database Information and Page Caching
04-02-2009, 12:50 AM
What exactly goes on when your browser caches a page that displays information from a database? The reason I'm asking is because I use a PHP session to cache my homepage. When I first experimented with that type of code, I used it on a page that just contained an HTML paragraph and no database info. I added a second paragraph and uploaded the new page, went to it, and nothing had changed because it was still cached. But when my session expired, then the new paragraph began to show.
But on my homepage, the information that comes from the database doesn't update when the session expires for some reason. It still remains cached, and I have to clear my cache and reload the page to get it to update. So is there an issue regarding databases and browser caches that I'm unaware of?
04-02-2009, 01:00 AM
Do not immediately assume the syntax is in error.
It's a good thing you said that...because otherwise I wouldn't have noticed your change!
That's the normal way to make a query with JSP code, so I would have glossed over it. <grin/>
I'm not aware that the server *SHOULD* be doing ANY caching of a page. Certainly wouldn't expect it to with JSP or ASP. And only when explicitly requested with ASP.NET.
Makes me think that *probably* the caching is occurring all in the browser. And easy way to both test and fix that is to append a random number or a time stamp to the query string in the URL.
For example, if you are using a form posting to get to the server code, do something like:
<form action="nameOfSamePage.php?junk=<?= someRandomNumber ?>" >
This forces the browser to believe that indeed it's getting a different page than it got before, so it *will* reload from the server.
If that fixes it, then indeed it's been all a browser issue. If not, then post back and maybe we can come up with other ideas.
04-02-2009, 01:31 AM
I'm going to go ahead and post my code in case anyone sees an error, because I have no idea how to do what you just said:p If you don't see an error in my code, do you mind walking me through what you instructed to do?:o
04-02-2009, 02:30 AM
I *assumed* (sorry! dangerous practice!) that one gets *to* this page via a link (e.g., <a href="....">) or <form> posting from another page (or pages).
So the randomizing tail you plunk the end of the URL has to be on that *other* page (or pages).
If people always just type in the URL to this page, then I don't know a good solution offhand.
04-02-2009, 07:34 AM
Dang. All right, thanks:) I tried it again today on a test page that just used HTML paragraphs, and like when I first tested it, it worked fine. I dunno why the database is affecting it that way.
I'll leave this thread unmarked in case anyone else has an idea as to what is wrong.
05-07-2009, 03:09 PM
Hi to all...
I am new to this forum and its my first post i am in great trouble :( i am a student and i have few questions please some one answer them these are as under:
1. What is page caching in database server and clint enviroment and how it happens ?
2. Why in page caching when we request full whole page retrived from memory if we need just some columns and why in tuple caching full tuples gets retrieved if some small data required by query?
3. Why semantic caching is better then both of these aproaches ?
I will be really thankful please some one help me
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.