本文介绍了apc.filters通过路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在APC操作码缓存中使用apc.filters参数不缓存某些路径?例如,我希望对路径下的任何内容都启用缓存:

"/var/www/vhosts"

并排除类似路径

"/usr/share/psa-horde/"

我尝试使用

apc.cache_by_default = 0
apc.filters = "+/var/www/vhosts"

apc.cache_by_default = 1
apc.filters = "-/usr/share/psa-horde/"

但是它们都不如我预期的那样工作.

http://www.php.net/manual/zh-CN/apc.configuration.php#ini.apc.filters

过滤器应该更像"+/var/www/vhosts/*"(请注意通配符)吗?恐怕由于过滤器的工作方式,这是不可能的:

有任何想法或示例配置吗?

解决方案

过滤器应为逗号分隔的POSIX扩展正则表达式列表.我相信您在第二次尝试中所拥有的仅匹配/usr/share/psa-horde/的确切路径,而不是/usr/share/psa-horde/something或/usr/share/psa-horde/anotherfile.php

以下内容应与子文件夹中的所有内容匹配

apc.filters = "-/usr/share/psa-horde/.*"

How would I use the apc.filters parameter in APC opcode caching to not cache certain paths? For example, I want caching to be active for anything under the path:

"/var/www/vhosts"

and exclude paths like

"/usr/share/psa-horde/"

I tried using

apc.cache_by_default = 0
apc.filters = "+/var/www/vhosts"

and

apc.cache_by_default = 1
apc.filters = "-/usr/share/psa-horde/"

But neither worked as I expected.

http://www.php.net/manual/en/apc.configuration.php#ini.apc.filters

Should the filter be something more like "+/var/www/vhosts/*" (note the wildcard)? I'm afraid this isn't possible because of the way filters works:

Any ideas or sample configurations?

解决方案

The filter should be a comma separated list of POSIX extended regular expressions. I believe what you have in the second attempt only matches the exact path /usr/share/psa-horde/, and not /usr/share/psa-horde/something or /usr/share/psa-horde/anotherfile.php

The following should match anything in the sub folder

apc.filters = "-/usr/share/psa-horde/.*"

这篇关于apc.filters通过路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 05:51