博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Redis - Redisson vs Jedis
阅读量:7182 次
发布时间:2019-06-29

本文共 1726 字,大约阅读时间需要 5 分钟。

Additional dependencies

  • Jedis requires Apache Commons Pool 2 for connection-pooling.
  • Redisson requires Netty, the JCache API and Project Reactor as basic dependencies.

Programming model

  • Jedis is a low-level driver exposing Redis API as Java method calls:
Jedis jedis = …;jedis.set("key", "value");List
values = jedis.mget("key", "key2", "key3");
  • Redisson is a high-level client, each call invokes one or more Redis calls, some of them are implemented with Lua (Redis "Scripting").
Redisson redisson = …RMap map = redisson.getMap("my-map"); // implement java.util.Mapmap.put("key", "value");map.containsKey("key");map.get("key");

Scalability

  • Jedis uses blocking I/O and method calls are synchronous. Your program flow is required to wait until I/O is handled by the sockets. There's no asynchronous (Future, CompletableFuture) or reactive support (Reactive Streams Publisher). Jedis client instances are not thread-safe hence they require connection-pooling (Jedis-instance per calling thread).
  • Redisson uses non-blocking I/O and an event-driven communication layer with netty. Connections are pooled, but the API itself is thread-safe and requires fewer resources. you can even operate on a single connection. That's the most efficient way when working with Redis.

Client implementation

  • Jedis gives you full control over the commands you invoke and the resulting behavior. 较底层,可塑性强,high-level features要自己实现。
  • Using Redissons high-level features means that you can use objects without the need of knowing they are backed by Redis (Map, List, Set, …)。省的自己去实现轮子。

总结:Redisson supports all the things Jedis supports and provides read strategies for Master/Slave setups, has improved support for AWS ElastiCache. 另外有。。。

转载地址:http://ppykm.baihongyu.com/

你可能感兴趣的文章
机器学习认知
查看>>
iOS应用程序生命周期(前后台切换,应用的各种状态)详解
查看>>
$GLOBALS ["HTTP_RAW_POST_DATA"]为空
查看>>
谷歌浏览器中,js首次打印,图片没显示
查看>>
设计自己解析XML字段,并反射到对应类
查看>>
linux 下安装maven + git直接编译项目
查看>>
oracle用sum函数实现累加
查看>>
java中创建对象的方法
查看>>
Python知识点总结篇(五)
查看>>
一致性算法探寻(扩展版)1
查看>>
Java中的浅拷贝与深拷贝
查看>>
微信小程序联盟:官方文档+精品教程+demo集合(6月9日更新,持续更新中……)...
查看>>
spring 事务的传播特性
查看>>
react学习(1)-Why React?
查看>>
RESTful风格的API接口开发教程
查看>>
用 Lua 实现一个微型虚拟机-基本篇
查看>>
php 安装 memcached 扩展出现 zlib 错误
查看>>
CentOS中服务程序随系统启动
查看>>
我的友情链接
查看>>
14个Web移动编程视频网站资源分享
查看>>