国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Redis - Redisson vs Jedis

阿羅 / 1125人閱讀

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

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要自己實現。

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://m.specialneedsforspecialkids.com/yun/68477.html

相關文章

  • 基于Redis實現分布式鎖

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

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

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

    neu 評論0 收藏0

發表評論

0條評論

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