By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

Cache for 24 hours since first access?

P: n/a
I've searched for days for an answer to this question; I hope someone
can help. I want to make sure that my web content is reasonably current,
but at the same time I don't want to bypass caching completely.

I'm looking for a way to cache a page for 24 hours after a user accesses
it, but if they come back after that time, then reload the page.

I understand using HTTP headers, rather than META tags, is the best way
for maximum compatibility.

I've seen a few scripts in something called PHP, but I don't think I can
use this on my site.

Can anyone help, or offer an alternative?
--
Nige

Please replace YYYY with the current year
ille quis mortem cum maximus ludos, vincat
Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Nige wrote:
I'm looking for a way to cache a page for 24 hours after a user accesses
it, but if they come back after that time, then reload the page.

I understand using HTTP headers, rather than META tags, is the best way
for maximum compatibility.
Correct.
I've seen a few scripts in something called PHP, but I don't think I can
use this on my site.
What does your host support?
Can anyone help, or offer an alternative?


What have you found so far? What does your host support? What kind of
software is you site driven by?

The information you give it to minimal to give a correct answer IMHO.

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #2

P: n/a
On Tue, 18 Nov 2003, Anne van Kesteren wrote:
Nige wrote:
I'm looking for a way to cache a page for 24 hours after a user accesses
it, but if they come back after that time, then reload the page.
[..] What have you found so far? What does your host support? What kind of
software is you site driven by?


Fair points, but maybe a preparatory read of
http://www.mnot.net/cache_docs/ would give the O.P a better
context in which to ask the question.

Jul 20 '05 #3

P: n/a
In comp.infosystems.www.authoring.html, Alan J. Flavell wrote:
http://www.mnot.net/cache_docs/ would give the O.P a better
context in which to ask the question.


I had actually read this, but since posting I've realised that HTTP
headers are sent by the server. I've contacted my host.

In the meantime, I'm using:

<head>
<META Http-Equiv="Cache-Control" Content="max-age=3600,
must-revalidate">

....
</head>
--
Nige

Please replace YYYY with the current year
ille quis mortem cum maximus ludos, vincat
Jul 20 '05 #4

P: n/a
Nige <uY***@ntlworld.com> writes:
<META Http-Equiv="Cache-Control" Content="max-age=3600,
must-revalidate">


3600 isn't 24 hours, by the way.

--
Chris
Jul 20 '05 #5

P: n/a
Nige <uY***@ntlworld.com> writes:
I've searched for days for an answer to this question; I hope someone
can help. I want to make sure that my web content is reasonably current,
but at the same time I don't want to bypass caching completely. [...] I've seen a few scripts in something called PHP, but I don't think I can
use this on my site.


Are you creating scripts, or normal HTML pages? If scripts, what
language?

If normal HTML pages, any sane web server will automatically send a
Last-Modified header for your page. If you're updating your page every
day, caches will re-check it at least daily.

Some web servers send unnecessary cookies, thus defeating shared
caches. You can check your page at the following URL:

http://www.ircache.net/cgi-bin/cacheability.py
Jul 20 '05 #6

P: n/a
In article <of********************************@4ax.com>,
Nige <uY***@ntlworld.com> wrote:
I've seen a few scripts in something called PHP, but I don't think I can
use this on my site.

Can anyone help, or offer an alternative?


In Apache .htaccess (if allowed):

ExpiresActive On
ExpiresDefault "access plus 24 hours"

http://httpd.apache.org/docs/mod/mod_expires.html

--
Henri Sivonen
hs******@iki.fi
http://iki.fi/hsivonen/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.