PHP APC not working with some chars in key?

こ雲淡風輕ζ 提交于 2019-12-24 10:17:29

问题


I have a few test installments of zend server CE (php5.3), one on Mac 10.8.2, one on Linux EC2 instance, both using the default APC implementation (zend data cache) that comes with the installation.

On both machines, I call:

apc_store("Installation:1234:lastActivity", "x", 120);

Then I call apc_fetch for that key.
On the Mac, apc_fetch works.
On the Linux, apc_fetch returns FALSE and fails.

Now for the weird stuff on the Linux box, a few tests I made:
1. If I remove the last char in the key (y), apc_fetch works.
2. If I change the colon (:) to slash (/), apc_fetch works.

Any ideas what is going on? thanks...


回答1:


The Zend Server doesn't actually use APC, instead using it's own implementation - the "Zend Data Cache". There appear to be some subtle differences between them.

One thing that the ZDC has is 'namespaces', where you prefix a key with a '{name}::', and then you can remove all keys that start with that prefix.

It may be that there is a bug when there are two (non consecutive) colons in the string. In the meantime, it's easy enough to simply tweak the structure of the key to avoid the problem.



来源:https://stackoverflow.com/questions/13720993/php-apc-not-working-with-some-chars-in-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!