I have been developing an EE2.0 module that makes use of several custom tables in the EE database. After upgrading from the beta to 2.1, settings that I change from my module’s control panel aren’t reflected on the module’s frontend pages until I clear the DB cache using the CP tool, even though the CP pages are updated just fine. Perhaps I didn’t use to have DB caching on and the issue isn’t related to 2.1, but I feel like I must not be doing something right. The docs mention the db cache being cleared when a table gets updated, but does this happen automatically? Does anybody have any idea what I could be doing wrong?
I have been developing an EE2.0 module that makes use of several custom tables in the EE database. After upgrading from the beta to 2.1, settings that I change from my module’s control panel aren’t reflected on the module’s frontend pages until I clear the DB cache using the CP tool, even though the CP pages are updated just fine. Perhaps I didn’t use to have DB caching on and the issue isn’t related to 2.1, but I feel like I must not be doing something right. The docs mention the db cache being cleared when a table gets updated, but does this happen automatically? Does anybody have any idea what I could be doing wrong?
I assume EE only does this for standard tables and that you have to do this yourself in case your module is using custom tables.
Has anybody else been dealing with similar issues?
I’m developing a module with custom tables, and the only way I can get changes to show up on the front end of the site is to disable database caching. Does anyone know if there’s a way I can fine tune my queries so that they’re never cached, and as a result, I could keep database caching turned on in the site? Or am I doomed to require database caching to be turned off?
The only related thing I’ve come across is the caching feature in the db class, but that seems to be utilized only if you explicitly call the caching functions, which I’ve made sure not to do.
I’ve found a workaround for this, if anyone’s wondering. If you check out the code under:
EE_Functions->clear_caching
you can see how the cache is cleared (it’s a simple directory deletion). If you look at the db cache folder, you can see that it’s organized nicely by folders named like “module+function” (this is wrong, read the edit below). So, to clear cache for a very specific thing, you just need to delete the directory that represents your function’s method. Here’s what I’m going to try:
$cache_sub_folder = "your_module+your_function";
$this->EE->functions->delete_directory(APPPATH.'cache/db_cache_'.
$this->EE->config->item('site_id')."/".$cache_sub_folder);EDIT:
It turns out the cache sub folder isn’t “your_module+your_function”; it’s actually “template_group+template”. You could still clear the cache sub folder for “segment1+segment2” in your mod file, but that doesn’t cover the scenario where you’re getting data from an ACT=x page (which is what I still need to figure out :shut: )
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.