Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2014-11-23 23:27:43
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Selective cache control
I’ve got some pages that show dynamic content retrieved from feeds and I’m seeing that updates are sometimes not being displayed.
I’m guessing that this is because the browser is displaying a cached version of the page, and that this is because TXP’s lastmod timestamp has not changed (due to the fact that there’ve been no changes in the database).
There seems to be a couple of workarounds, neither of which are ideal:
- set Send “Last-Modified” header? to “no” – this would effectively switch off caching for all pages, resulting in increase bandwidth usage, load times etc.
- use
update_lastmod()
on these pages – somewhat misleading, as nothing in the database has actually changed
I know this has been discussed before but is there a nice way of selectively (on a per page/section basis) getting the browser to discard it’s cached version & reload the page?
Offline
Re: Selective cache control
You can try
<txp:mg_setheader name="Last-Modified"
value='<txp:php>echo safe_strftime('rfc822', time(), 1);</txp:php>' />
or some other no-cache header in the concerned article forms.
Offline
#3 2014-11-24 22:24:51
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: Selective cache control
Thanks etc, I’ll give it a go.
Offline
Re: Selective cache control
On the second thought, you should have more success with
<txp:mg_setheader name="Cache-Control"
value="no-store, no-cache, must-revalidate, post-check=0, pre-check=0" />
Offline
Pages: 1