The 'cacheable' property was initially introduced in the (now gone) hook_fieldable_info() hook, back when Field API was the only thing to talk about 'entities'.

'cacheable' = TRUE meant 'use Field API internal field data cache for this entity type, because it does not handle its own persistent cache for objects'.

Since the entity API got in and hook_fieldable_info() got merged with hook_entity_info(), the property name is ambiguous. From the 'entity type' perspective, field cache comes into play if the entity type is *not*.

It should be renamed 'persistent cache' (to match the existing 'static cache' property), and have its meaning reverted (FALSE triggers the Field cache)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Status: Active » Needs review
FileSize
9.13 KB

It should be renamed 'persistent cache' (to match the existing 'static cache' property), and have its meaning reverted (FALSE triggers the Field cache)

Attached patch goes for a simpler renaming of 'cacheable' to 'field cache'. This is actually more in line with the existing 'static cache' property (a feature enabled by default, but that can be bypassed). Meaning of TRUE / FALSE remains unchanged, FALSE means 'bypass field API cache'.

Patch also removes $cacheable from the list of info returned by entity_extract_ids(). Does not belong there, the information can be read directly from entity_get_info() if needed (rare in practice).

catch’s picture

Works for me, RTBC if the test bot comes back green. The only module which gets broken by this (that I know of) is entitycache, which I maintain, and it's a 5 minute find and replace there.

Status: Needs review » Needs work

The last submitted patch, entity_info_cacheable-754686-2.patch, failed testing.

yched’s picture

Status: Needs work » Needs review
FileSize
9.13 KB

Oops, wrong default value, from my initial take which reversed semantics for TRUE / FALSE.

yched’s picture

Status: Needs review » Reviewed & tested by the community

RTBC as per #2.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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