function expire_user in Cache Expiration 6
Implementation of hook_user().
Acts on user account actions: expire the relevant user page from the static page cache to prevent serving stale content.
File
- ./
expire.module, line 104 - Provides logic for page cache expiration
Code
function expire_user($op, &$edit, &$account, $category = NULL) {
// Return if no user id is attached to the user object.
if (empty($account->uid)) {
return;
}
// Select which user opperations require a cache flush.
$cases = array(
'insert',
'update',
'after update',
);
// Expire the relevant user page from the static page cache to prevent serving stale content.
if (in_array($op, $cases)) {
$paths[] = 'user/' . $account->uid;
$flushed = expire_cache_derivative($paths, $account);
watchdog('expire', 'User !op for !uid resulted in !flushed pages being expired from the cache', array(
'!op' => $op,
'!uid' => $account->uid,
'!flushed' => $flushed,
));
}
}