magento使用产品id以编程方式清除特定产品的缓存

magento使用产品id以编程方式清除特定产品的缓存,magento,caching,Magento,Caching,正如我的问题所说,我想使用产品id删除特定产品的缓存(全页缓存)。这可能吗?每个型号都有cleanModelCache()方法,该方法使用型号标记清理缓存 请参阅Mage_目录_模型_产品::cleanModelCache() Mage::app()->cleanCache($tags)是清理缓存的内容 如果只想使用产品ID进行清理,则需要至少加载与该产品关联的类别,并为方法Mage\u Catalog\u Model\u product::getCacheIdTagsWithCategorie

正如我的问题所说,我想使用产品id删除特定产品的缓存
(全页缓存)
。这可能吗?

每个型号都有cleanModelCache()方法,该方法使用型号标记清理缓存

请参阅Mage_目录_模型_产品::cleanModelCache()

Mage::app()->cleanCache($tags)是清理缓存的内容

如果只想使用产品ID进行清理,则需要至少加载与该产品关联的类别,并为方法
Mage\u Catalog\u Model\u product::getCacheIdTagsWithCategories()


你找到解决办法了吗?检查我的答案
public function cleanModelCache()
    {
        $tags = $this->getCacheIdTagsWithCategories();
        if ($tags !== false) {
            Mage::app()->cleanCache($tags);
        }
        return $this;
    }
public function getCacheIdTagsWithCategories()
    {
        $tags = $this->getCacheTags();
        $affectedCategoryIds = $this->_getResource()->getCategoryIdsWithAnchors($this);
        foreach ($affectedCategoryIds as $categoryId) {
            $tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
        }
        return $tags;
    }