Entity cache only supports core entities. However, for contrib, implementing entitycache support doesn't seem too hard.
1) Adding this code to the controller object looks like it should work for tying into the caching system:
public function resetCache(array $ids = NULL) {
if (module_exists('entitycache')) {
EntityCacheControllerHelper::resetEntityCache($this, $ids);
}
parent::resetCache($ids);
}
public function load($ids = array(), $conditions = array()) {
if (module_exists('entitycache')) {
return EntityCacheControllerHelper::entityCacheLoad($this, $ids, $conditions);
}
else {
return parent::load($this, $ids, $conditions);
}
}
2) We have to add the cache bin to hook_schema() and a hook_update to create the cache bin. We should create the table even if entity cache isn't enabled, even though the table isn't used, otherwise management will be a pain in the keester.
3) We need to implement hook_flush_caches to add the cache bin.
4) There might be more I haven't seen in a quick examination of the module.
Comments
Comment #1
merlinofchaos commentedOh yes.
4) We need to set the 'entity cache' and 'field cache' keys in the entity_info appropriately if entity cache is enabled.
Comment #2
dave reidSounds pretty straight forward. Did you want to take this on Earl or should I get started on it?
Comment #3
merlinofchaos commentedWell there's a bug in my above code, where parent::load() shouldn't have a $this. :)
Comment #4
merlinofchaos commentedI don't know if/when I'll get to it. If you want to do it, go for it. If it hasn't been done in, you know, a while (Determined based on my completely unscientific method of "when I realize it hasn't been done yet and want to go do it") then I'll do it then. :)
Comment #5
dave reidPatch ready for review.
Comment #6
dave reidErg, didn't make patch after I had saved an edit.
Comment #7
dave reidI was looking into adding some db_table_exists() wrappers in case the user hasn't run update.php yet and hits flush_caches or any entity load/saving. But I think I'm just going to commit as is. We shouldn't hand-hold for people that can't update when there is clearly updates to run. It doesn't really 'break' anything, it just has warnings about the cache table not existing.
Comment #8
dave reidTested and committed #6 to 7.x-1.x. http://drupalcode.org/project/fieldable_panels_panes.git/commit/742340a