public static function RestfulManager::invalidateEntityCache in RESTful 7
Delete cached entities from all the cache bins associated to restful resources.
Parameters
string $cid: The wildcard cache id to invalidate.
5 calls to RestfulManager::invalidateEntityCache()
- RestfulReferenceTestCase::testEntityReference in tests/
RestfulReferenceTestCase.test - Test field reference.
- 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
- includes/
RestfulManager.php, line 292 - Contains \RestfulManager.
Class
- RestfulManager
- @file Contains \RestfulManager.
Code
public static function invalidateEntityCache($cid) {
$plugins = restful_get_restful_plugins();
foreach ($plugins as $plugin) {
$handler = restful_get_restful_handler($plugin['resource'], $plugin['major_version'], $plugin['minor_version']);
if (method_exists($handler, 'cacheInvalidate')) {
$version = $handler
->getVersion();
// Get the uid for the invalidation.
try {
$uid = $handler
->getAccount(FALSE)->uid;
} catch (\RestfulUnauthorizedException $e) {
// If no user could be found using the handler default to the logged in
// user.
$uid = $GLOBALS['user']->uid;
}
$version_cid = 'v' . $version['major'] . '.' . $version['minor'] . '::' . $handler
->getResourceName() . '::uu' . $uid;
$handler
->cacheInvalidate($version_cid . '::' . $cid);
}
}
}