简体   繁体   English

线程缓存是否比memcaching更快?

[英]Is threadcaching faster than memcaching?

I recently plugged memcaching into my PHP web software. 我最近将memcaching插入了我的PHP网络软件。 I have a class, Cache, that manages storing things in my memcache pool. 我有一个Cache类,用于管理将内容存储在Memcache池中。 In that class, I also maintain an member array--a "threadcache"--that stores up to 100 of the most-used items. 在该类中,我还维护一个成员数组(一个“线程缓存”),该成员数组最多可存储100个最常用的项。

My question is, is threadcaching going to be faster than memcaching? 我的问题是,线程缓存会比memcaching更快吗? I would think so, coming from the argument that a memcache request potentially goes through my local network, to another computer's RAM, back through the network, and back to the requesting computer's RAM. 我会这样认为,来自这样一个论点:内存缓存请求可能会通过我的本地网络到达另一台计算机的RAM,再通过网络再回到请求计算机的RAM。 Whereas, with threadcaching, everything would happen locally on the server running the PHP request. 而使用线程缓存,一切将在运行PHP请求的服务器上本地发生。

Unless the local cache class is very poorly designed and doesn't handle concurrency very well, it will be much faster. 除非本地缓存类设计得很差并且不能很好地处理并发性,否则它将更快。 All other things being equal, retrieving data from local memory is always going to be faster than from another system's memory. 在所有其他条件相同的情况下,从本地内存中检索数据总是比从另一个系统的内存中检索数据更快。

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

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