You are here

function performance_prune_apc in Performance Logging and Monitoring 7

Same name and namespace in other branches
  1. 6 performance.module \performance_prune_apc()

Helper function to cleanup APC data.

See also

performance_data_stores()

File

./performance.module, line 551
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_prune_apc($timestamp = 0, $threshold = 0) {

  // Get all entries in APC's user cache.
  $list = performance_apc_list_all();
  if (!count($list)) {

    // Nothing stored yet.
    return;
  }
  foreach ($list as $key) {
    if ($data = apc_fetch($key)) {
      if ($data['last_access'] <= $timestamp || $threshold && $data['num_accesses'] <= $threshold) {
        apc_delete($key);
      }
    }
  }
}