You are here

public function APDQCache::getCaller in Asynchronous Prefetch Database Query Cache 7

Get the last 3 items from debug_backtrace.

Return value

array An array of items from debug_backtrace.

2 calls to APDQCache::getCaller()
APDQCache::callCacheClearHooks in ./apdqc.cache.inc
Allow for 3rd party modules to react to cache clear calls.
APDQCache::clear in ./apdqc.cache.inc
Implements DrupalCacheInterface::clear().

File

./apdqc.cache.inc, line 861
Extends Drupal's default database cache so async queries happen.

Class

APDQCache
A pretty darn quick cache implementation of Drupal's default cache backend.

Code

public function getCaller() {
  $bt = debug_backtrace();
  $caller = array();
  foreach ($bt as $key => $call) {
    if (!empty($call['class']) && $call['class'] == 'APDQCache') {
      continue;
    }
    if (empty($call['function']) || $call['function'] == 'cache_clear_all') {
      continue;
    }

    // Get this and the next 2 levels from the backtrace.
    $caller[$key] = $call;
    if (isset($bt[$key + 1])) {
      $caller[$key + 1] = $bt[$key + 1];
      if (isset($bt[$key + 2])) {
        $caller[$key + 2] = $bt[$key + 2];
      }
    }
    break;
  }
  return $caller;
}