memory based cache that supports cache_clear_all wildcard??
ball.in.th - July 28, 2009 - 19:29
| Project: | Cache Router |
| Version: | 6.x-1.0-beta8 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hi,
I am so confused by the all the issues regarding cache_clear_all wildcard. Please let me know if there is a memory based cache, e.g. apc, memcache, xcache, or whatever, that supports cache_clear_all wildcard. If none do, what steps should be done as a work around? Or should I just use the Drupal core caching?

#1
Could someone please enlight me how to use memory based cache properly?
#2
All engines support cache_clear_all, although they each implement it differently. APC / XCache, use a lookup table stored in the cache to keep track of each cache entry.
#3
#4
So only APC and XCache support wildcards? memcache doesn't?
#5
Memcache supports wildcards in both shared mode (when multiple caches use the same memcached instance) and in non-shared mode natively. The reason APC/XCache/Eaccelerator use lookup tables is because it is one giant blob of data. Yet we may only want to flush one table which is currently unavailable to do with those cache storages. With memcache you can flush a single memcached instance and in general setups that is how you would want to set up memcached. Each cache "bin" gets it's own instance.
#6
Please help, cache_clear_all with wildcard prefix doesn't work for me. I've tested with this code:
<?php$txt = 'hello';
$now = time();
cache_set('blah1', $txt, 'cache', $now + 30*60);
cache_set('blah2', $txt, 'cache', $now + 30*60);
cache_clear_all('blah', 'cache', true);
drupal_set_message('<pre>' . htmlspecialchars(print_r(array('get blah1', cache_get('blah1')), TRUE), ENT_QUOTES) . '</pre>');
drupal_set_message('<pre>' . htmlspecialchars(print_r(array('get blah2', cache_get('blah2')), TRUE), ENT_QUOTES) . '</pre>');
?>
The standard drupal cache result were as expected, i.e. blah1 and blah2 got cleared:
*
Array
(
[0] => get blah1
[1] => 0
)
*
Array
(
[0] => get blah2
[1] => 0
)
However, with cacherouter and memcache, blah1 and blah2 didn't get cleared as expected:
*
Array
(
[0] => get blah1
[1] => stdClass Object
(
[cid] => blah1
[created] => 1251999381
[expire] => 1252001181
[headers] =>
[data] => hello
)
)
*
Array
(
[0] => get blah2
[1] => stdClass Object
(
[cid] => blah2
[created] => 1251999381
[expire] => 1252001181
[headers] =>
[data] => hello
)
)
My settings.php is setup like this:
<?php$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'db',
'server' => array(),
'shared' => TRUE,
'prefix' => '',
'path' => 'sites/default/files/filecache',
'static' => FALSE,
'fast_cache' => FALSE,
),
'cache' => array(
'engine' => 'memcache',
'server' => array('localhost:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => 'sites/default/files/filecache',
'static' => FALSE,
'fast_cache' => FALSE,
),
);
?>
#7
Automatically closed -- issue fixed for 2 weeks with no activity.