You are here

function performance_log_summary_memcache in Performance Logging and Monitoring 6

Same name and namespace in other branches
  1. 7 performance.module \performance_log_summary_memcache()

Helper function to store summary data in Memcache.

See also

performance_data_stores()

File

./performance.module, line 624
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_log_summary_memcache($params = array()) {
  $key = PERFORMANCE_KEY . $params['path'];
  $result = performance_build_summary_data(cache_get($key, PERFORMANCE_MEMCACHE_BIN), $params);
  if ($result['type'] == 'new') {

    // $keys_cache is used to easily retrieve our data later on.
    if ($keys_cache = cache_get(PERFORMANCE_KEY, PERFORMANCE_MEMCACHE_BIN)) {
      $keys_values = $keys_cache->data;
    }
    $keys_values[$key] = 1;
    cache_set(PERFORMANCE_KEY, $keys_values, PERFORMANCE_MEMCACHE_BIN, CACHE_PERMANENT);
  }
  cache_set($key, $result['data'], PERFORMANCE_MEMCACHE_BIN, CACHE_PERMANENT);
}