You are here

private static function fastcache::FixKeyAndBin in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/fastcache.inc \fastcache::FixKeyAndBin()

Add test prefix to current binary key, and account for atomic items where $bin = NULL;

Parameters

string $prefix:

3 calls to fastcache::FixKeyAndBin()
fastcache::cache_clear_all in sqlsrv/fastcache.inc
cache_clear_all wrapper.
fastcache::cache_get in sqlsrv/fastcache.inc
cache_get wrapper.
fastcache::cache_set in sqlsrv/fastcache.inc
cache_set wrapper.

File

sqlsrv/fastcache.inc, line 50

Class

fastcache
Static caching layer.

Code

private static function FixKeyAndBin(&$cid, &$bin) {

  // We always need a binary, if non is specified, this item
  // should be treated as having it's own binary.
  if (empty($bin)) {
    $bin = $cid;
  }

  // Try with the "official" test_run_id first.
  if (isset($GLOBALS['drupal_test_info']['test_run_id'])) {
    $bin = $GLOBALS['drupal_test_info']['test_run_id'] . $bin;
    return;
  }

  // Only do this once per request, if the this is the testing system
  // then $GLOBALS['drupal_test_info']['test_run_id'] will be set upon
  // test context switching.
  if (!isset(static::$test_run_id)) {
    if ($test_prefix = drupal_valid_test_ua()) {

      // Keep a local copy of the current test_prefix.
      static::$test_run_id = $test_prefix;
    }
    else {
      static::$test_run_id = '';
    }
  }
  $bin = static::$test_run_id . $bin;
}