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

資訊專欄INFORMATION COLUMN

Redis - Redisson vs Jedis

阿羅 / 1121人閱讀

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

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. 較底層,可塑性強(qiáng),high-level features要自己實(shí)現(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, …)。省的自己去實(shí)現(xiàn)輪子。

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

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

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/68477.html

相關(guān)文章

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

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

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

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

    neu 評論0 收藏0

發(fā)表評論

0條評論

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