For the configuration part you can add the config cache tag when saving the item:
Mage::app()->saveCache($data, $id, array(
Mage_Core_Model_Config::CACHE_TAG
), $lifeTime=false);
which will delete your cached item every time this tag gets cleared.
Unfortunately this does not extend to the tax settings and there is no tax specific tag. Instead you can create your own cache tag (MY_TAX_CACHE_TAG
).
Mage::app()->saveCache($data, $id, array(
Mage_Core_Model_Config::CACHE_TAG,
'MY_TAX_CACHE_TAG'
), $lifeTime=false);
Additionally you would need to create an observer on tax_settings_change_after
.
class Observer
{
public function taxSettingsChangeAfter($observer)
{
Mage::app()->cleanCache('MY_TAX_CACHE_TAG');
}
}