You are here

protected function ApdqcCacheTestCase::checkCacheExists in Asynchronous Prefetch Database Query Cache 7

Check whether or not a cache entry exists.

Parameters

string $cid: The cache id.

mixed $var: The variable the cache should contain.

string $bin: The bin the cache item was stored in.

Return value

bool TRUE on pass, FALSE on fail.

3 calls to ApdqcCacheTestCase::checkCacheExists()
ApdqcCacheClearCase::testCacheTemporary in ./apdqc.test
Tests CACHE_TEMPORARY behavior.
ApdqcCacheClearCase::testClearArray in ./apdqc.test
Test clearing using an array.
ApdqcCacheTestCase::assertCacheExists in ./apdqc.test
Assert that a cache entry exists.

File

./apdqc.test, line 41
Tests for the Asynchronous Prefetch Database Query Cache module.

Class

ApdqcCacheTestCase
Add new functionality to DrupalWebTestCase.

Code

protected function checkCacheExists($cid, $var, $bin = NULL) {
  if ($bin == NULL) {
    $bin = $this->defaultBin;
  }
  $cache = new APDQCache($bin);
  $cached = $cache
    ->get($cid);
  return isset($cached->data) && $cached->data == $var;
}