You are here

function expire_nodeapi in Cache Expiration 6

Implementation of hook_nodeapi().

Acts on nodes defined by other modules.

File

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

Code

function expire_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {

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

  // Select which node opperations require a cache flush.
  $cases = array(
    'insert',
    'update',
    'delete',
    'delete revision',
  );

  // Expire the relevant node page from the static page cache to prevent serving stale content.
  if (in_array($op, $cases)) {
    expire_node($node);
  }
}