public function MemCacheClearCase::clearWildcardPrefixTest in Memcache API and Integration 7
Same name in this branch
- 7 tests/memcache.test \MemCacheClearCase::clearWildcardPrefixTest()
- 7 tests/memcache6.test \MemCacheClearCase::clearWildcardPrefixTest()
Same name and namespace in other branches
- 6 tests/memcache.test \MemCacheClearCase::clearWildcardPrefixTest()
Test cache clears using wildcard prefixes.
4 calls to MemCacheClearCase::clearWildcardPrefixTest()
- MemCacheClearCase::testClearWildcardLifetime in tests/
memcache.test - Test clearing using wildcard prefix, with cache lifetime.
- MemCacheClearCase::testClearWildcardLifetime in tests/
memcache6.test - Test clearing using wildcard prefix, with cache lifetime.
- MemCacheClearCase::testClearWildcardNoLifetime in tests/
memcache.test - Test clearing using wildcard prefixes, no cache lifetime.
- MemCacheClearCase::testClearWildcardNoLifetime in tests/
memcache6.test - Test clearing using wildcard prefixes, no cache lifetime.
File
- tests/
memcache.test, line 632 - Test cases for the memcache cache backend.
Class
- MemCacheClearCase
- Test cache clearing methods.
Code
public function clearWildcardPrefixTest() {
$this
->resetVariables();
cache_set('test_cid_clear:1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear:2', $this->default_value, $this->default_bin);
$this
->assertTrue($this
->checkCacheExists('test_cid_clear:1', $this->default_value) && $this
->checkCacheExists('test_cid_clear:2', $this->default_value), t('Two caches were created for checking cid substring with wildcard true.'));
cache_clear_all('test_cid_clear:', $this->default_bin, TRUE);
$this
->assertFalse($this
->checkCacheExists('test_cid_clear:1', $this->default_value) || $this
->checkCacheExists('test_cid_clear:2', $this->default_value), t('Two caches removed after clearing cid substring with wildcard true.'));
// Test for the case where a wildcard object disappears, for example a
// partial memcache restart or eviction.
cache_set('test_cid_clear:1', $this->default_value, $this->default_bin);
$this
->assertTrue($this
->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was created successfully.');
cache_clear_all('test_', $this->default_bin, TRUE);
$this
->assertFalse($this
->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was cleared successfully.');
// Delete the wildcard manually to simulate an eviction.
$wildcard = '.wildcard-test_cid_clear:';
dmemcache_delete($wildcard, $this->default_bin);
// Reset the memcache_wildcards() static cache.
// @todo: this is a class object in D7.
// memcache_wildcards(FALSE, FALSE, FALSE, TRUE);
$this
->assertFalse($this
->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was cleared successfully.');
}