具有 LRU 过期功能的内存缓存
我正在为我的 PHP 驱动的网站寻找内存缓存。这不是高流量的网站,我只是想缓存数据和部分页面以提高性能。数据大小从几个字节到几 kB 不等。我目前正在使用xCache,没有任何问题。
改用memcached好还是redis好?还有更好的选择吗?
I am looking for an in memory cache for my PHP powered website. It is not high traffic website, I just want to cache data and parts of some pages for improving performance. The data size will vary from a few bytes to few kBs. I am currently using xCache, and have no problem with it.
Is it better to switch to memcached or redis? Are there any better options?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你没有任何明显的问题,为什么现在要切换? Memcached 或 Redis 可能更好,但如果您现在不需要它们,最好离开它们。只要您的缓存策略是合理的并且缓存接口是抽象的,您应该能够在以后当您确实需要切换到可扩展缓存时添加它们。
PHP 中的 xCache 也是一个 opcoder 缓存。 redis 或多或少类似于进程外键值对。如果您的站点在 2 或 3 个服务器上运行,并且您需要它们共享的上下文而不仅仅是保留单个实例,那么这些缓存将会有所帮助。
If you don't have any obvious problem, why do wanna switch right now? Memcached or redis are probably better but if you don't need them right now, it is better to leave them. As long as your caching strategy is sound and cache interface is abstracted you should be able to add them later when you actually feel the need to switch to a scalable cache.
Also xCache in PHP is an opcoder cache.. Memcache & redis are more or less like a out of proc key Value pair.. If your site is running on 2 or 3 server and you need the context b.w them shared not just kept individual instances, those caches will help.
就我个人而言,我使用 APC,因为我已经将它用于操作码缓存。这样我就需要维护更少的东西。我使用APC的另一个原因是,它计划包含在下一个PHP版本中,所以我觉得它更“稳定”。
虽然很明显:您应该更改您的缓存系统,只是为了更改它;)如果 XCache 没有造成任何问题,您可能应该保留它。
Personally, I use APC, because I already use it for Opcode Caching. This way I have to maintain fewer things. Another reason for me to use APC is, that it is planned to be included in the next PHP version, so I feel more "stable" on it.
Though obviously: You should change your caching system, just for the sake of changing it ;) If XCache doesn't make any problems, you probably should just keep it.