I am working on a custom component and it works as intended as long as I do not have cache enabled.

In the admin section of the component, I have a view that can change the "component params":

$params = JComponentHelper::getParams( 'com_example' );
$params->set( 'customsetting', 'test' );

$componentid = JComponentHelper::getComponent('com_example')->id;
$table = JTable::getInstance('extension');
$table->bind(array('params' => $params->toString()));

if (!$table->check()) {
    echo $table->getError();
if (!$table->store()) {
    echo $table->getError();

and load that setting with

$params = JComponentHelper::getParams( 'com_example' );
$setting = $params->get( 'customsetting' );

As I mentioned, this works without cache. But with cache, I cannot update the setting.

I guess I need to clear the cache after I change the component parameters, but I could not figure out how.

I tried parent::cleanCache('com_hbmanager');, but it had no effect. https://docs.joomla.org/Cache also didn't help me finding a solution.

Is there a way to clear the cache for the parameters of a component?

  • I've just come across this question - did you get it sorted? I tried it out and it did cache it when the system Page Cache plugin was enabled, as you describe. However to get round it I cleaned the cache for "_system" before I read the parameters with getParams(). Looking at the code in ComponentHelper.php, that's what is passed to getCache() to load the parameters in the load() function. – Robbie Jackson Jan 2 '20 at 14:44
  • I didn't find a way to do it yet. I will try your suggestion when I get a chance – jost21 Jan 4 '20 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.