In-memory cache with LRU expiration

半城伤御伤魂 提交于 2020-01-14 05:57:09

问题


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?


回答1:


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.

--Sai




回答2:


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.



来源:https://stackoverflow.com/questions/4835832/in-memory-cache-with-lru-expiration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!