如何在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/"但是它们都不如我预期的那样工作.
www.php/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.
www.php/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:
Note that the filename used for matching is the one passed to include/require, not the absolute path.
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通过路径?
发布评论