function MemCacheClearCase::clearWildcardPrefixTest in Zircon Profile 8
Same name in this branch
- 8 modules/memcache/tests/memcache.test \MemCacheClearCase::clearWildcardPrefixTest()
- 8 modules/memcache/tests/memcache6.test \MemCacheClearCase::clearWildcardPrefixTest()
Same name and namespace in other branches
- 8.0 modules/memcache/tests/memcache.test \MemCacheClearCase::clearWildcardPrefixTest()
- 8.0 modules/memcache/tests/memcache6.test \MemCacheClearCase::clearWildcardPrefixTest()
Test cache clears using wildcard prefixes.
4 calls to MemCacheClearCase::clearWildcardPrefixTest()
- MemCacheClearCase::testClearWildcardLifetime in modules/
memcache/ tests/ memcache.test - Test clearing using wildcard prefix, with cache lifetime.
- MemCacheClearCase::testClearWildcardLifetime in modules/
memcache/ tests/ memcache6.test - Test clearing using wildcard prefix, with cache lifetime.
- MemCacheClearCase::testClearWildcardNoLifetime in modules/
memcache/ tests/ memcache.test - Test clearing using wildcard prefixes, no cache lifetime.
- MemCacheClearCase::testClearWildcardNoLifetime in modules/
memcache/ tests/ memcache6.test - Test clearing using wildcard prefixes, no cache lifetime.
File
- modules/
memcache/ tests/ memcache.test, line 422
Class
- MemCacheClearCase
- Test cache clearing methods.
Code
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.');
}