我们运行Magento 1.13,其中memcached作为我们的“快速”缓存,而redis用于“慢速”缓存。我们有一个memcached密钥,每秒得到大约70个get请求,但点击量为0%。这只发生在我们的生产站点上,它有多个前端服务器和一个单独的数据库服务器。
似乎这个特定的键从未被设置过,但是我们找不到密钥的来源。键使用md5散列"AA_B1B5D70089938E5C32F61E616FD3908D",因此这无助于缩小它的范围。
我能在哪里找到这把钥匙的来历?
发布于 2015-06-25 13:57:12
我想出了办法。在app/code/core/Mage/Core/Model/App.php中,查找:
public function loadCache($id)
{
return $this->_cache->load($id);
}在此函数中,需要添加临时检查:
public function loadCache($id)
{
if (strstr($id, 'b1b5d70')) {
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$cacheId = $this->_cache->load($id);
$stack = Varien_Debug::backtrace(true, true);
Mage::log("Mage_Core_Model_App: " . $id, null, "memcacheKeys.log", true);
Mage::log($currentUrl, null, "memcacheKeys.log", true);
Mage::log($cacheId, null, "memcacheKeys.log", true);
Mage::log($stack, null, "memcacheKeys.log", true);
}
return $this->_cache->load($id);
}我们在这里检查部分memcached密钥,'b1b5d70‘。到目前为止,密钥尚未转换为大写。local.xml中定义的前缀'AA_‘也尚未添加。
保存到日志中的回溯跟踪应该告诉您在何处生成密钥。在我的例子中,它可以追溯到'app/code/core/Mage/Catalog/Block/Product/Price.php'.
https://stackoverflow.com/questions/31006092
复制相似问题