在cache_lite中按名称删除缓存

时间:2011-01-24 17:11:53

标签: php caching

假设我将这些变量保存在cache_lite中:

article_1_0
article_1_1
article_3_2
article_3_3
article_2_4

如何删除以article_3_开头的所有缓存变量(最多可以达到10000)?

或者换句话说,我如何列出缓存的变量??

1 个答案:

答案 0 :(得分:2)

尝试通过指定组值来保存cache_lite变量,然后尝试通过指定该组值来清除它 即:

$cache->save($dataarticle_1_0,"article_1_0","article_1");
$cache->save($dataarticle_1_1,"article_1_1","article_1");
$cache->save($dataarticle_3_2,"article_3_2","article_3");
$cache->save($dataarticle_3_3,"article_3_3","article_3");
$cache->save($dataarticle_2_4,"article_2_4","article_2");

然后删除以article_3_开头的所有缓存变量,你可以这样做

$cache->clean("article_3");

希望这是解决方案