Techie
Techie

Reputation: 45124

Joomla clear cache for a specific page only

I want to clear cache on a specific page ? I'm using Joomla as my CMS. Whats the override do I have to do? What's the code should I insert into my view?

Thanks

Upvotes: 0

Views: 2573

Answers (2)

Michael Shpigelman
Michael Shpigelman

Reputation: 31

When you enable "System - Cache" under the plugins, your pages will be simply cached. To delete a cache of a page I used this:

$url = "test";

$options = array(
    'defaultgroup'  => 'page',
    'browsercache'  => false,
    'caching'       => false,
);

$cache = JCache::getInstance('page',$options);

$id = md5(serialize("/$url"));

$cache->remove($id,'page');

Upvotes: 3

Lodder
Lodder

Reputation: 19733

You can't clear the browsers cache using server side commands. You can only prevent things from being cached. Im not sure how you would go about doing it for every single thing on a page, but for an article for example, you could install the PHP Direct plugin then add the following code (untested):

<?php
  header("Cache-Control: no-cache, must-revalidate");
  header("Expires: Wed, 01 Jan 2020 05:00:00 GMT");
  header("Content-Type: application/xml; charset=utf-8");
?>

Don't forget to use the php tags.

Upvotes: 0

Related Questions