简体   繁体   English

完全替代PHP的APC用户数据缓存?

[英]Full alternative to APC user data cache for PHP?

I have a large site heavily depending on APC, mainly storing custom data using apc_add and apc_fetch functions. 我有一个严重依赖APC的大型站点,主要使用apc_addapc_fetch函数存储自定义数据。

It seems that APC is not fully compatible with PHP 5.4 and that PHP 5.5 has built in Zend OPcache . 似乎APC与PHP 5.4不完全兼容PHP 5.5已在Zend OPcache中内置 What alternative do I have to replace apc_add and apc_fetch functionality ? 我必须替代apc_add和apc_fetch功能吗?

Please don't mention memcached, I am already using it, but it is not suitable as direct replacement of APC because I am doing many apc_fetch calls because APC is much faster than memcached for this purpose. 请不要提及memcached,我已经在使用它,但是它不适合直接替换APC,因为我正在执行许多apc_fetch调用,因为为此目的,APC比memcached快得多。

Thanks for any suggestions and help. 感谢您的任何建议和帮助。

Edit: I thought, that suggested APCu is good choice, however it has the same issues with stability (PHP segfaults)... Is there any other alternative how to store local user cache data ? 编辑:我认为,建议使用APCu是一个不错的选择,但是它在稳定性方面存在相同的问题(PHP segfaults)...还有其他替代方法如何存储本地用户缓存数据?

There is APCu, the APC user cache: http://pecl.php.net/package/APCu 有APC用户缓存APCu: http ://pecl.php.net/package/APCu

It only contains the user cache part, with apcu_* functions instead of the apc_* ones. 它不仅包含用户的缓存部分,与apcu_*功能,而不是apc_*的。

YAC is another alternative ( https://github.com/laruence/yac ). YAC是另一种选择( https://github.com/laruence/yac )。 It's lockless which can lead to: 它是无锁的,可能导致:

  1. better performance 更好的性能
  2. getting unexpected data in certain situations 在某些情况下获取意外数据

If your application can tolerate (2) or is built in such a way that it's not a problem, then YAC seems like a good alternative. 如果您的应用程序可以容忍(2)或以没有问题的方式构建,则YAC似乎是一个不错的选择。

APC User-Cache suitable for high load environments? APC User-Cache是​​否适合高负载环境? also has good information about some of the issues of APCu and why YAC can solve some of those problems. 关于APCu的一些问题以及YAC为什么可以解决其中的一些问题,他也有很好的信息。

There is also an interesting discussion about php caching on reddit: http://www.reddit.com/r/PHP/comments/1k2w45/the_future_of_caching_in_php/ 关于reddit上的php缓存,还有一个有趣的讨论: http : //www.reddit.com/r/PHP/comments/1k2w45/the_future_of_caching_in_php/

If anyone is wondering what I have ended up doing - I use XCache now. 如果有人想知道我最终要做什么-我现在使用XCache It's surely not perfect - mainly because of its very weak (if any at all) documentation. 它肯定不是完美的-主要是因为它的文档非常薄弱(如果有的话)。 But it's stable, maintained, and works as expected so it is pretty much good replacement of APC now. 但是它是稳定的,可维护的,并且可以按预期工作,因此它现在可以很好地替代APC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM