English 中文(简体)
Magento, memcaled, and tags
原标题:Magento, memcached, and tags

I have spent the better part of the last week configuring and tweaking the caching for our Magento store and it is working great on my dev install. I have Tinybrick s Lightspeed and Speedbooster extensions along with some customizations. It does full page caching and properly flushes the correct tags when I edit a product so that only the pages affected get flushed. I initially set it up using file caching and only just switched it over to Memcached. On my local dev server, this is still working great. When I put it on the remote dev server running in the same environment as our live site, this doesn t work as expected. For the most part it is good, but when I edit a product, I have to flush the entire cache to see the change. After doing some research I have learned that Memcached doesn t support flushing by matching tag...or at least that s what I understood from the Zend documentation:

Be careful : with this backend, "tags" are not supported for the moment as the "doNotTestCacheValidity=true" argument.

另外,如果你看一下档案的来源<代码>。 Zend/Cache/Backend/Memcastal.php in the clean/

case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
    $this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_MEMCACHED_BACKEND);
    break;

However, on my local dev server, it seems to be working fine, which I really can t explain. So that begs the question, "Why?". Are there differences in versions of the Zend Framework or PHP that may affect this? My local dev server is running the following:

PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch (cli) (built: Oct 14 2011 22:31:25) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Our dev/live server is running this:

PHP 5.2.17 (cli) (built: Jun 13 2011 14:23:24) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

这难道不是差别吗? 是否有这方面的经验? 如果这实际上是一种框架限制,是否知道围绕什么工作? 或者,我只是做了一些错误的事情吗?

Thanks!

最佳回答

According to this jira ticket, tags aren t supported for almost all backends in zf. You proposed to use hybrid backend Zend_Cache_Backend_TwoLevels instead. And magento already uses it! Look into Mage_Core_Model_Cache::_getBackendOptions(). So, now we should look into Zend_Cache_Backend_TwoLevels::clean() source code, for example:

        case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
            $ids = $this->_slowBackend->getIdsMatchingTags($tags);
            $res = true;
            foreach ($ids as $id) {
                $bool = $this->remove($id);
                $res = $res && $bool;
            }
            return $res;
            break;

如你所看到,如果发现标签,就会发现背心缓慢的对口,则从两端中删除。 因此,你们的低端支持者或政党都存在一些错误,但却没有出现缓慢的背后(一些背后同步问题)。

您可以读到以下几条:

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...