The way EntityCache is currently supported, modules depending on Entity API will still need to detect and decide if EntityCache should be used. In keeping with the simplicity of EntityCache as it pertains to core entities, I'd like to see this module default to use the cache (it would then be responsible for creating the bin tables), but still allow modules depending on it to disable that if necessary.

Comments

fago’s picture

I'm not keen on having the bin tables auto-created even if there is no entitycache module available. Maybe, we can enable support for that only if another cache bin is configured? Or we could make a hidden conf variable for that?

I guess most people are going to use other cache backends anyway.

jhedstrom’s picture

Given the drastic performance improvements that EntityCache offers, even on the normal cache backend, I think it would be beneficial for the Entity API module to make integration with that as simple as possible.

Given that such popular projects as Commerce and Field Collection require Entity API, I don't think it's safe to assume the standard use-case will involve alternative cache backends. However, even if that were the case, having Entity API control EntityCache integration would make life that much simpler for both users of the default cache, and the alternative cache backends.

It's possible that this change might make more sense going into the EntityCache module itself.

fago’s picture

Project: Entity API » Entity cache
Component: Entity CRUD controller » Code

>It's possible that this change might make more sense going into the EntityCache module itself.

I like that idea. It would be great if the EntityCache module could care about creating the cache bins, or maybe just go with an "entitycache" cache bin by default and making using custom bins optional.

Once we've that working I think it's not up to the entity.api module any more to enable entitycache by default, but users could just do

 'entity cache' => TRUE,
 'field cache' => module_exists('entitycache'),

.

Thus, moving over to entitycache.

fago’s picture

(double post)

catch’s picture

I would like entitycache to create bins automatically, however it's probably not going to happen for this reason:

Creating bins is probably fine - do a db_table_exists() check in hook_modules_installed() and check entity_get_info() for new modules.

Removing bins won't work - when a module is uninstalled, hook_entity_info() won't return information about the entity type being removed, so we can't remove the bin.

If someone can come up with a relatively simple workaround for this that'd be great, but otherwise I'm not keen.

See also #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed.

jhedstrom’s picture

Would something like a simple variable that tracks which entity types have had bins created for them be a sufficient workaround?

webflo’s picture

Related issue in Countries issue queue. I have created a new module for entity cache integration. see #1397762: Entity cache integration

tstoeckler’s picture

Also hit this for profile2. I posted a patch over there against Entity API. It suffers from the problem catch denotes in #5, I didn't think of that (it's untested so far).

Here's a patch, which builds on that and simply tracks the tables to drop in a variable. Not the most beatiful solution, obviously, but it works. We're simply missing a hook_modules_pre_uninstalled() or something.

Not setting to needs review, as this is against entity module.

steven jones’s picture

So I posted patches against ECK and Field collection to add entity cache support and we've done it by implementing a simple boilerplate module that just depends on both Entitycache and the module providing the entity, which just seems like a neat way to sidestep this whole issue.

#1268620: Use Entity Cache in Field Collection
#1506468: EntityCache support

tstoeckler’s picture

dasjo’s picture

skwashd’s picture

This was fixed in Entity API (see #2017685).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Fidelix’s picture

Thanks!