You are here

function expire_user_insert in Cache Expiration 7

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

Implements hook_user_insert

Acts on user account creation

File

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

Code

function expire_user_insert(&$edit, $account, $category = NULL) {

  // 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 created resulting in !flushed pages being expired from the cache', array(
    '!uid' => $account->uid,
    '!flushed' => $flushed,
  ));
}