Skip to main content
fixed typo
Source Link
jost21
  • 239
  • 2
  • 11

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->load($componentid);
$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_hbmanager''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 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->load($componentid);
$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_hbmanager' );
$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 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->load($componentid);
$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?

Source Link
jost21
  • 239
  • 2
  • 11

How can I clear the cache for the params of a custom component?

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->load($componentid);
$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_hbmanager' );
$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?