Entitycache module provides hooks to act on entities after:

  • being removed from the entitycache: hook_entitycache_reset()
  • being loaded from the entitycache: hook_entitycache_load()

Is there a possibility the Entitycache module could be even made more versatile by adding a hook to act on entities after being added to the entity cache?

CommentFileSizeAuthor
#1 hook_entitycache_set-2159775-0.patch1.57 KBrp7
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rp7’s picture

Attached a patch. New hooks would be:

  • hook_entitycache_set($entities, $entity_type)
  • hook_entitycache_ENTITY_TYPE_set($entities)
Vacilando’s picture

Great idea — and the patch works perfectly! Hoping it will be committed to dev soon.

catch’s picture

Status: Active » Postponed (maintainer needs more info)

This needs an explanation of the use case.

rp7’s picture

I'm working on a module to pro-actively cache items into the entity cache (https://www.drupal.org/sandbox/raf/2190935). This is done by tracking which entity has been cached already, and which hasn't. Therefore it heavily relies on this hook.

amontero’s picture

Perhaps the Cache Object API module might be useful.
Also, I've linked to another similar issue.