PHP APC无法在键中使用某些字符? [英] PHP APC not working with some chars in key?

查看:86
本文介绍了PHP APC无法在键中使用某些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几次zend服务器CE(php5.3)的测试分期,其中一个在Mac 10.8.2上,一个在Linux EC2实例上,均使用安装随附的默认APC实现(zend数据缓存)./p>

在两台计算机上,我都致电:

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

然后,我将该密钥称为apc_fetch.
在Mac上,apc_fetch有效.
在Linux上,apc_fetch返回FALSE并失败.

现在,对于Linux机器上的怪异东西,我做了一些测试:
1.如果删除键(y)中的最后一个字符,则apc_fetch起作用.
2.如果我将冒号(:)更改为斜杠(/),则apc_fetch起作用.

有什么想法吗? 谢谢...

解决方案

Zend Server实际上并不使用APC,而是使用它自己的实现-"Zend数据缓存".它们之间似乎存在一些细微的差异.

ZDC拥有的一件事是命名空间",在其中以"{name} :::"作为键的前缀,然后您可以删除以该前缀开头的所有键.

当字符串中有两个(非连续的)冒号时,可能是一个错误.同时,只需调整密钥的结构就可以避免问题,这很容易.

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...

解决方案

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.

这篇关于PHP APC无法在键中使用某些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆