PHP APC not working with some chars in key?

2019-08-09 08:39发布

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条回答
甜甜的少女心
2楼-- · 2019-08-09 09:31

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.

查看更多
登录 后发表回答