是否有纯粹用Node.js编写的数据库(mysql)查询缓存实现?
Is there an implementation of database (mysql) query caching written purely in Node.js?
我正在编写一个Node Web应用程序,并计划使用memcached缓存查询,但是考虑到这一点,我意识到有可能改为通过单独的Node.js层进行缓存
I'm writing a Node web app and was planning on caching queries with memcached, but while considering this I realised it's probably possible to do the caching through a separate Node.js layer instead
说明:
您可以通过单独端口上的节点服务器查询数据库,从可用的内存中返回数据,然后将其加载到不可用的内存中.
You could query the database through a node server on a separate port, returning data from memory where available and loading it into memory where it isn't.
任何人都知道在散列数组的返回速度方面,Node.js将如何与memcache进行比较?这是白日梦还是我应该看的东西?
Anyone know how Node.js would compare to memcache in terms of return speed on hashed arrays? Is this a pipe-dream or something I should look at?
推荐答案我继续写了一个供个人使用的缓存解决方案,该解决方案将数据存储在共享对象中.这并不是真正的查询缓存,它存储特定的结果,而不是按哈希排序的原始sql结果,但是它将我所需的内容保留在内存中,并且易于编写.
I went ahead and wrote a caching solution for private use that stored the data in a shared object. This wasn't really query caching, it stores specific results instead of raw sql results ordered by hashes, but it kept what I needed in memory and was ridiculously easy to write.
自从我最初问这个问题以来,出现了许多节点缓存解决方案:
Since I originally asked this question a number of node caching solutions have emmerged:
我没有使用过任何一个,但是其中一个可能对其他人有用.
I haven't used any of these but one of them might well be of use to someone else.
现在还有 redis 和内存缓存客户端.
更多推荐
使用Node.js缓存数据库查询
发布评论