Memcache v/s redis是否用于维持持久性会话? [英] Memcache v/s redis for maintaining persistent sessions?

查看:87
本文介绍了Memcache v/s redis是否用于维持持久性会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在服务器上进行持久性会话,我正在使用带有express的node.js,首先我了解了connect-redis 在此处输入链接描述,并在以下位置connect-mongo 在此处输入链接描述我读到redis比mongo更快,这就是为什么我决定使用它,但是现在我也找到了一个名为memcached的模块

I want to make persistent sessions on server i am using node.js with express and for that first i read about connect-redis enter link description here and connect-mongo enter link description here i read that redis is faster then mongo that's why i decided to use it but now i also find a module named memcached enter link description here i dont know which will be better for my project, also in mamcache is data stored in memory or where because if it is memory then it must be fastest.

推荐答案

如果您已经设置了Redis,那么我会坚持使用它,因为它非常快速且易于管理. MemCached和Redis在用于缓存时非常相似,但是主要区别在于Redis可以设置为在后台持久保存到磁盘,这意味着如果服务器关闭,则可以重新加载内存中的数据.

If you have already setup Redis then I would stick with it as it is very fast and easy to manage. MemCached and Redis are very similar when used for caching however the key difference is that Redis can be set to persist to disk in the background meaning that if the server goes down the data in memory can be reloaded.

就个人而言,出于速度原因,我不会将MongoDb用于会话持久性,但是,如果我使用的是MemCached,则可能会将其用作会话的备份.例如将会话数据写入MemCached和Mongo,但仅从MemCached读取并使用Mongo进行还原会发生错误.

Personally, I would not use MongoDb for session persistence for speed reasons however if I was using MemCached I'd possibly use it as a backup for the sessions. e.g. Write session data to MemCached and Mongo but only read from MemCached and use Mongo to restore is an error occurs.

最重要的是,我认为您选择使用Redis是您所描述的最好的选择

Bottom line, I think your choice to use Redis is the best one for what you've described

这篇关于Memcache v/s redis是否用于维持持久性会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆