成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

Redis - Redisson vs Jedis

阿羅 / 1127人閱讀

摘要:較底層,可塑性強,要自己實現(xiàn)。省的自己去實現(xiàn)輪子。總結另外有中文文檔。。。

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.Map

map.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要自己實現(xiàn)。

Using Redissons high-level features means that you can use objects without the need of knowing they are backed by Redis (Map, List, Set, …)。省的自己去實現(xiàn)輪子。

總結:Redisson supports all the things Jedis supports and provides read strategies for Master/Slave setups, has improved support for AWS ElastiCache. 另外有中文文檔。。。

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉載請注明本文地址:http://systransis.cn/yun/68477.html

相關文章

  • 基于Redis實現(xiàn)分布式鎖

    摘要:本篇博客將介紹第二種方式,基于的實現(xiàn)分布式鎖??偨Y本文主要介紹了如何使用代碼正確實現(xiàn)分布式鎖,對于加鎖和解鎖也分別給出了兩個比較經典的錯誤示例。其實想要通過實現(xiàn)分布式鎖并不難,只要保證能滿足可靠性里的四個條件。 前言 分布式鎖一般有三種實現(xiàn)方式:1.數(shù)據(jù)庫樂觀鎖;2、基于Redis的分布式鎖;3.基于Zookeeper的分布式鎖。本篇博客將介紹第二種方式,基于Redis的實現(xiàn)分布式鎖。...

    jonh_felix 評論0 收藏0
  • JAVA面試題(36)

    摘要:請輸入代碼本文首發(fā)于的博客轉載請注明出處和有哪些區(qū)別參考博客優(yōu)點輕量簡潔支持連接池支持事務缺點不支持讀寫分離文檔支持不足官方推薦優(yōu)點采用非阻塞支持異步請求支持連接池支持支持讀寫分離以及讀負載平衡可與集成文檔支持充足怎么保證緩存和數(shù)據(jù)庫數(shù)據(jù)的 請輸入代碼????本文首發(fā)于cartoon的博客????轉載請注明出處:https://cartoonyu.github.io/c... Je...

    neu 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<