I have a custom component I've built, and it has a search filter toolbar to filter results. The problem is that when Joomla caching is turned on, the filters get cached along with the page data-- so you submit the form to set new filters, and it simply returns the cached page, pre-filter.

How do you set a no-cache header or otherwise force Joomla to ignore the cached version of a view when you pass new parameters?


The behavior happens with both Conservative or Progressive cache, happens with both File and Memcached.

2 Answers 2


You didn't state what cache settings are producing this problem. Joomla has several cache levels https://docs.joomla.org/Cache.

The most aggressive caching option is Page Caching (turned on via the cache system plugin). This will pick out a cached page based on the URI BEFORE your component is even run. Here I think your only option would be to set your form's method to "get", this will pass the form field's data as part of the querystring, so each unique search should generate a unique cached page. This also has the advantage of allowing users to press the browser's back button without the browser asking if they want to repost the form's data. However, the downside is that your page URL's might become less readable as the querystring can quickly become very long depending on the number of filters you have.

If you aren't using the system plugin, but are instead activating the cache via the site's global config then this is called 'view' caching, and can be handled by your component's controller.

In this case you will need to build a cacheid from the posted form data to ensure that a unique cached page is created per set of filters:

// Create the view
$view = $this->getView('myView', 'html');

// Build a cache id which will be unique per search: 
$user = JFactory::getUser();
$uri = JURI::getInstance();
$input = JFactory::getApplication()->input;
$cacheId = serialize(array($uri, $input->post, $user->get('id')));

// Create the cache
$cache = JFactory::getCache('com_mycomponent', 'view');
$cache->get($view, 'display', $cacheId);

I've cut out and condenced the above code from Fabrik's list controller https://github.com/Fabrik/fabrik/blob/joomla3/components/com_fabrik/controllers/list.php which has to deal with a similar issue.

  • Thanks Rob. However, using this code throws a 500 error: Unable to load Cache Controller: myviewname
    – user101289
    Apr 3, 2015 at 15:19
  • did you edit 'myView' in line 1 to the correct view name, and 'com_mycomponent' in the second last line? Apr 8, 2015 at 9:41
  • How would you do this for Joomla modules? Mar 23, 2017 at 11:06
  • It seems that when including jumi code using the jumi module, that code is not cached. Mar 23, 2017 at 14:19

Joomla has more cache levels,


and if you can using extensions,




Using caching for module or component independently

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.