function restful_entity_clear_render_cache in RESTful 7.2
Delete the scheduled fragments and caches on shutdown.
1 call to restful_entity_clear_render_cache()
- RestfulRenderCacheTestCase::testRenderCache in tests/
RestfulRenderCacheTestCase.test - Test Render Cache.
4 string references to 'restful_entity_clear_render_cache'
- restful_entity_delete in ./
restful.entity.inc - Implements hook_entity_delete().
- restful_entity_update in ./
restful.entity.inc - Implements hook_entity_update().
- restful_user_delete in ./
restful.entity.inc - Implements hook_user_delete().
- restful_user_update in ./
restful.entity.inc - Implements hook_user_update().
File
- ./
restful.entity.inc, line 170 - Contains entity related code.
Code
function restful_entity_clear_render_cache() {
if ($hashes = drupal_static('restful_entity_clear_hashes', array())) {
$hashes = array_unique($hashes);
drupal_static_reset('restful_entity_clear_hashes');
$resource_manager = restful()
->getResourceManager();
foreach ($hashes as $hash) {
if (!($instance_id = CacheFragmentController::resourceIdFromHash($hash))) {
continue;
}
$handler = $resource_manager
->getPlugin($instance_id);
if (!$handler instanceof CacheDecoratedResourceInterface) {
continue;
}
if (!$handler
->hasSimpleInvalidation()) {
continue;
}
// You can get away without the fragments for a clear.
$cache_object = new RenderCache(new ArrayCollection(), $hash, $handler
->getCacheController());
// Do a clear with the RenderCache object to also remove the cache
// fragment entities.
$cache_object
->clear();
}
}
}