Skip to content

Instantly share code, notes, and snippets.

@gabesullice
Created February 25, 2015 23:33
Show Gist options
  • Save gabesullice/cecdcca780b651413ee0 to your computer and use it in GitHub Desktop.
Save gabesullice/cecdcca780b651413ee0 to your computer and use it in GitHub Desktop.
Demonstrates enabling entitycache for custom entities.
<?php
/**
* @file
* The Bean Entity cache module.
*/
/**
* Implements hook_entity_info_alter().
*/
function bean_entitycache_entity_info_alter(&$entity_info) {
// Enable Entity Cache support for beans.
$entity_info['bean']['entity cache'] = TRUE;
// Which means that we don't need to cache the fields.
$entity_info['bean']['field cache'] = FALSE;
// Provide bean entitycache controller so other modules using entitycache can
// work with beans.
$entity_info['bean']['controller class'] = 'BeanEntityCacheAPIController';
}
/**
* Implements hook_flush_caches().
*/
function bean_entitycache_flush_caches() {
return array('cache_entity_bean');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment