You are here

function expire_user_delete in Cache Expiration 7

Same name and namespace in other branches
  1. 7.2 expire.module \expire_user_delete()

Implements hook_user_delete

Acts on user account deletion

File

./expire.module, line 180
Provides logic for page cache expiration

Code

function expire_user_delete($account) {

  // Return if no user id is attached to the user object.
  if (empty($account->uid)) {
    return;
  }

  // Expire the relevant user page from the static page cache to prevent serving stale content.
  $paths[] = 'user/' . $account->uid;
  $flushed = expire_cache_derivative($paths, $account);
  watchdog('expire', 'User !uid was deleted resulting in !flushed pages being expired from the cache', array(
    '!uid' => $account->uid,
    '!flushed' => $flushed,
  ));
}