在node.js中缓存数据的最便宜方法? [英] Cheapest way to cache data in node.js?
问题描述
我正在实现一个运行匹配算法的node.js服务器。由于我想使服务器尽可能快地响应,因此我希望能够从缓存中检索数据,而不是每次都查询数据库。例如,我需要保留有关10000-50000用户的信息。我担心这会占用大量RAM。有什么方法可以将大量数据存储在缓存中而又不会有用完RAM的风险?
I am implementing a node.js server running a matching algorithm. Since I want to keep the server responding as quickly as possible, I would like to be able to retrieve data from a cache instead of querying the database every single time. For example, I need to keep information about 10000 - 50000 users. My fear is that this would take up a lot of RAM. Is there any way to store that much data in a cache without the risk of running out of RAM?
推荐答案
您可以使用memcached或redis,他们自己关心内存,但是内存不足会删除过时的数据
You can use memcached or redis, who themselves care about memory and its lack removed obsolete data
这篇关于在node.js中缓存数据的最便宜方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!