问题:
当我从magento admin
刷新所有缓存时,不使用memcached缓存文件。
我在magento上安装了memcached
它的统计数据如下所示,并在local.xml文件中完成配置,如下所述。
请一些身体帮助使它工作。
我怀疑configuration
或memcached
可能有问题。
stats
STAT pid 8897
STAT uptime 149352
STAT time 1331275345
STAT version 1.4.6
STAT libevent 2.0.17-stable
STAT pointer_size 64
STAT rusage_user 0.026995
STAT rusage_system 0.030995
STAT curr_connections 5
STAT total_connections 8
STAT connection_structures 7
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 21
STAT bytes_written 1628
STAT limit_maxbytes 536870912
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
我配置了app/etc/config.xml
<config>
<global>
<cache>
<backend>memcached</backend><!-- apc / memcached / empty=file -->
<memcached><!-- memcached cache backend related config -->
<servers><!-- any number of server nodes can be included -->
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
</server>
</servers>
<compression><![CDATA[0]]></compression>
<cache_dir><![CDATA[]]></cache_dir>
<hashed_directory_level><![CDATA[]]></hashed_directory_level>
<hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
<file_name_prefix><![CDATA[lb-]]></file_name_prefix>
</memcached>
</cache>
<install>
<date><![CDATA[Fri, 11 Nov 2011 16:02:21 +0000]]></date>
</install>
<crypt>
<key><![CDATA[admin]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[username]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[dbnam]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
答案 0 :(得分:2)
首先,请务必检查Memcache守护程序是否实际运行
ps ax | grep memcache
然后,确保您已实际安装了PHP扩展
在文档中搜索Memcache以确保它实际已加载。
这是Memcache无法工作的两个唯一原因。
验证Memcache是否正在使用非常简单。
然后清空
的内容./var/cache/*
目录,然后在前端重新加载页面并观察上述目录的内容。如果它仍然为空,则使用Memcache。
请参阅http://www.sonassi.com/knowledge-base/magento-kb/what-is-memcache-actually-caching-in-magento/
答案 1 :(得分:2)
参考以下设置:
<config>
<global>
<session_save><![CDATA[]]></session_save> <!-- db / memcache / empty=files -->
<session_save_path><![CDATA[]]></session_save_path><!-- e.g. for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 -->
<session_cache_limiter><![CDATA[]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values -->
<cache>
<backend></backend><!-- apc / memcached / xcache / empty=file -->
<slow_backend></slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->
<memcached><!-- memcached cache backend related config -->
<servers><!-- any number of server nodes can be included -->
<server>
<host><![CDATA[]]></host>
<port><![CDATA[]]></port>
<persistent><![CDATA[]]></persistent>
<weight><![CDATA[]]></weight>
<timeout><![CDATA[]]></timeout>
<retry_interval><![CDATA[]]></retry_interval>
<status><![CDATA[]]></status>
</server>
</servers>
<compression><![CDATA[0]]></compression>
<cache_dir><![CDATA[]]></cache_dir>
<hashed_directory_level><![CDATA[]]></hashed_directory_level>
<hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
<file_name_prefix><![CDATA[]]></file_name_prefix>
</memcached>
</cache>
</global>
</config>
另外,请确保已正确配置PHP memcache.ini
文件,如下所示:
$ aptitude install php5-memcache
$ aptitude install memcached
extension=memcache.so
[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0
;Use memcache as a session handler
session.save_handler=memcache
;Defines server urls to use for session storage
session.save_path="tcp://localhost:11211?persistent=1&weight=2&timeout=10&retry_interval=10"
答案 2 :(得分:0)
根据您使用的Magento版本,local.xml选项中会有一些更改用于缓存。在永不版本中,您应该定义后端和slow_backend,并将Memcache配置为后端。
这些方面的内容可能有所帮助:
<cache>
<slow_backend></slow_backend>
<fast_backend>memcached</fast_backend>
<fast_backend_options>
<servers>
<server>
<host>127.0.0.1</host>
<port>11211</port>
<persistent>1</persistent>
</server>
</servers>
</fast_backend_options>
<backend>memcached</backend>
<memcached>
<servers>
<server>
<host>127.0.0.1</host>
<port>11211</port>
<persistent>1</persistent>
</server>
</servers>
</memcached>
</cache>
答案 3 :(得分:0)
前几天我遇到了这个问题。如果我正确记住它是由于没有将file_name_prefix留空(或<![CDATA[]]>
)