You are here

protected function MemcacheTestCase::checkCacheExists in Memcache API and Integration 7

Same name in this branch
  1. 7 tests/memcache.test \MemcacheTestCase::checkCacheExists()
  2. 7 tests/memcache6.test \MemcacheTestCase::checkCacheExists()
Same name and namespace in other branches
  1. 6 tests/memcache.test \MemcacheTestCase::checkCacheExists()

Check whether or not a cache entry exists.

Parameters

string $cid: The cache id.

mixed $var: The variable the cache should contain.

string $bin: Defaults to $this->default_bin. The bin the cache item was stored in.

Return value

bool TRUE on pass, FALSE on fail.

2 calls to MemcacheTestCase::checkCacheExists()
MemcacheTestCase::assertCacheExists in tests/memcache.test
Assert or a cache entry exists.
MemcacheTestCase::assertCacheExists in tests/memcache6.test
Assert or a cache entry exists.

File

tests/memcache.test, line 164
Test cases for the memcache cache backend.

Class

MemcacheTestCase
@file Test cases for the memcache cache backend.

Code

protected function checkCacheExists($cid, $var, $bin = NULL) {
  if ($bin == NULL) {
    $bin = $this->default_bin;
  }
  $cache = cache_get($cid, $bin);
  return isset($cache->data) && $cache->data == $var;
}