You are here

function xautoload_ClassFinder_ApcCache::findFile in X Autoload 7.2

Parameters

string $class: The class that wants to be autoloaded.

File

lib/ClassFinder/ApcCache.php, line 27

Class

xautoload_ClassFinder_ApcCache

Code

function findFile($api, $class) {
  $key = $this->prefix . ':' . $class;
  $file = apc_fetch($key);
  if (!empty($file)) {
    if ($api
      ->suggestFile($file)) {
      return TRUE;
    }
    else {

      // Value in cache no longer valid.
      apc_delete($key);
    }
  }

  // Class was not found in cache, or cache is no longer valid,
  // so we ask the finder.
  if ($this->finder
    ->findFile($api, $class)) {
    apc_store($key, $api
      ->getFile());
    return TRUE;
  }
}