Echo Memcache 键值?

Echo Memcache Key Value?

我在寻找如何仅回显 Memcache 中特定键的值时遇到问题。我花了最后几个小时到处找,找不到我需要的东西。

memcache 数组如下所示(mcservers 的值会定期更改):

O:8:"stdClass":2:{s:8:"str_attr";s:9:"mc servers";s:8:"int_attr";i:5;}

我只想在我的 php 页面上回显 int_attr 的值。我该怎么做?

也许你的内存缓存有问题。实际上,memcache returns 反序列化项目,但你的似乎是一个序列化的字符串,有时,通过 Tokyo Tyrant 客户端访问 memcache,也许得到这个 error.Pls 检查它。 否则,您可以立即通过这些代码获得int_attr:

$obj = $memcache->get($key);echo $obj->int_attr;