你是对的。Memcache 不支持标签。
您可以使用另一个键值来为 memcache 实现标签。
前任 :
$this->objCache->save($arrResults, $strKey,array($strMyTag),$intCacheTime) // note : array($strMyTag) don't work for Memcache
MemcacheTag::setTag($strKey, $strMyTag) // our work around
关于 setTag 方法和 MemcacheTag:
function setTag($strKey,$strTag){
$arrKey = $cacheOjb->get($strTag);
$arrKey[]= $strKey;
}
function deleteCacheWithTag($strTag){
$arrKey = $cacheOjb->get($strTag);
foreach ($arrKey as $strKey){
$objCache->delete($strKey);
}
}
这种解决方法非常简单,它适用于我的项目。
*注:这些代码需要一些修改,抱歉匆忙发布