memcached和Redis的一些比较

举报
Amrf 发表于 2020/05/27 15:08:32 2020/05/27
【摘要】 Redis与Memcached对比:https://medium.com/@Alibaba_Cloud/redis-vs-memcached-in-memory-data-storage-systems-3395279b0941Redis支持服务端数据操作,并且支持更多的数据结构并支持更丰富的数据操作;如果需要缓存支持更复杂的结构和操作,Redis更好;Memcached对于简单的键值存储具...

Redis与Memcached对比:

https://medium.com/@Alibaba_Cloud/redis-vs-memcached-in-memory-data-storage-systems-3395279b0941

  • Redis支持服务端数据操作,并且支持更多的数据结构并支持更丰富的数据操作;如果需要缓存支持更复杂的结构和操作,Redis更好;

  • Memcached对于简单的键值存储具有更高的内存利用率。但是,如果Redis采用哈希结构,则会比Memcached具有更高的利用率;

  • Redis仅适用单核,而Memcached使用多个内核,平均来看,Redis在小数据存储方面拥有更高的性能,但存储100k数据以上时Memcached要更优;

  • Redis支持字符串,哈希,列表,集合和有序集合

  • Redis中,并非所有数据都在内存中进行。

  • Redis支持数据持久性操作包括RDB快照和AOF日志。

  • Memcached本身不支持分布式模式。您只能通过分布式算法(如Consistent Hash)在客户端上实现Memcached的分布式存储。

  与只能在客户端实现分布式存储的Memcached相比,Redis更喜欢在服务器端构建分布式存储。

Django中配置memcached:

https://medium.com/@netfluff/memcached-for-django-ecedcb74a06d

  • 系统设置

memcached.exe -d install  | sudo apt-get install memcached
memcached.exe -d start    |
-------------------------------------------------------
pip install python-memcached
  • Django设置

# settings.py

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}
from django.core.cache import cache
def my_view(request):
    cache_key = 'my_unique_key' # needs to be unique
    cache_time = 86400 # time in seconds for cache to be valid
    data = cache.get(cache_key) # returns None if no key-value pair
    if not data:
        my_service = Service()
        data = service.get_data()
    
    cache.set(cache_key, data, cache_time)
return JsonResponse(data, safe=False)


Openresty中memcached使用:

https://github.com/openresty/lua-resty-memcached

使用OpenResty实现流控:

https://www.nosuchfield.com/2019/07/04/Flow-control-using-OpenResty/

win7 安装Memcache:

https://blog.csdn.net/Alex_Best/article/details/5802294

Memcached和Memcache安装:

https://blog.csdn.net/LANGZI7758521/article/details/86583646

Redis总结:

https://zhuanlan.zhihu.com/p/54513277

memcached命令参考:

https://www.runoob.com/memcached/

SpringBoot中使用Redis缓存:

https://blog.csdn.net/u014449560/article/details/82807880

在共享内存实现 Redis(上)

https://cloud.tencent.com/developer/article/1005881

MongoDB和redis的区别,mmap

https://blog.csdn.net/fanlei5458/article/details/81005798

https://www.jianshu.com/p/2b523fbee36f

https://stackoverflow.com/questions/5400163/when-to-redis-when-to-mongodb

mongodb,redis,mysql 简要对比

https://www.cnblogs.com/lovychen/p/5613986.html

使用node存储图片到mongodb

https://medium.com/@alvenw/how-to-store-images-to-mongodb-with-node-js-fb3905c37e6d

MongoDB启动配置:

https://www.jianshu.com/p/f179ce608391

openresty操作mongodb:

https://www.cnblogs.com/tm2015/p/7505438.html

OpenResty中使用Lua的MongoDB库,使用连接池节省连接认证时间

https://renqiang.xyz/2016/12/24/OpenResty%E4%B8%AD%E4%BD%BF%E7%94%A8Lua%E7%9A%84MongoDB%E5%BA%93%EF%BC%8C%E4%BD%BF%E7%94%A8%E8%BF%9E%E6%8E%A5%E6%B1%A0%E8%8A%82%E7%9C%81%E8%BF%9E%E6%8E%A5%E8%AE%A4%E8%AF%81%E6%97%B6%E9%97%B4/

Mongodb基本语法

https://juejin.im/post/5c68cbfa6fb9a049e2328b4e

mongodb基本语法归纳

https://www.jianshu.com/p/d7dad6dfe3c6

mongo数据库的各种查询语句示例

https://blog.csdn.net/qq_27093465/article/details/51700435

MongoDB mapreduce介绍

https://medium.com/@mallikarjuna91/mongodb-mapreduce-introduction-649f8533f509

MongoDB mapreduce速度提升

https://www.oschina.net/translate/how-to-speed-up-mongodb-map-reduce-by-20x

MongoDB中MapReduce介绍与使用

https://www.cnblogs.com/chenpingzhao/p/7913247.html

Mongodb高级篇-MapReduce

https://www.jianshu.com/p/5a24629e1126


【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。