<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce</id>
	<title>Jedis、Redisson与lettuce - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce&amp;action=history"/>
	<updated>2026-04-29T08:49:59Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce&amp;diff=3064&amp;oldid=prev</id>
		<title>Eijux：​/* Lettuce */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce&amp;diff=3064&amp;oldid=prev"/>
		<updated>2021-05-10T11:00:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Lettuce&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年5月10日 (一) 19:00的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l113&quot;&gt;第113行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第113行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;demo：&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;demo：【？？？】&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;RedisClient client = RedisClient.create(&amp;quot;redis://localhost&amp;quot;);  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;RedisClient client = RedisClient.create(&amp;quot;redis://localhost&amp;quot;);  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect();  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;RedisStringCommands sync = connection.sync();  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect();  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;String value = sync.get(&amp;quot;key&amp;quot;);  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;RedisStringCommands sync = connection.sync();  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;String value = sync.get(&amp;quot;key&amp;quot;);  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;//////////////////// &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect();  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect();  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;RedisStringAsyncCommands&amp;lt;String, String&amp;gt; async = connection.async();  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;RedisStringAsyncCommands&amp;lt;String, String&amp;gt; async = connection.async();  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;RedisFuture&amp;lt;String&amp;gt; set = async.set(&amp;quot;key&amp;quot;, &amp;quot;value&amp;quot;)&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;RedisFuture&amp;lt;String&amp;gt; set = async.set(&amp;quot;key&amp;quot;, &amp;quot;value&amp;quot;)  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;RedisFuture&amp;lt;String&amp;gt; get = async.get(&amp;quot;key&amp;quot;)&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;RedisFuture&amp;lt;String&amp;gt; get = async.get(&amp;quot;key&amp;quot;)  &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;async.awaitAll(set, get) == true  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;async.awaitAll(set, get) == true&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;;  &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;set.get() == &amp;quot;OK&amp;quot;  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;set.get() == &amp;quot;OK&amp;quot; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;get.get() == &amp;quot;value&amp;quot;  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;get.get() == &amp;quot;value&amp;quot; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce&amp;diff=3063&amp;oldid=prev</id>
		<title>Eijux：​建立内容为“category:Redis  == 关于 ==   === Jedis === '''Jedis''' 是Java 实现的Redis 客户端，它的 API 提供了全面的类似于 Redis 原生命令的支持…”的新页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Jedis%E3%80%81Redisson%E4%B8%8Elettuce&amp;diff=3063&amp;oldid=prev"/>
		<updated>2021-05-10T10:58:06Z</updated>

		<summary type="html">&lt;p&gt;建立内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:Redis&quot; title=&quot;分类:Redis&quot;&gt;category:Redis&lt;/a&gt;  == 关于 ==   === Jedis === &amp;#039;&amp;#039;&amp;#039;Jedis&amp;#039;&amp;#039;&amp;#039; 是Java 实现的Redis 客户端，它的 API 提供了全面的类似于 Redis 原生命令的支持…”的新页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:Redis]]&lt;br /&gt;
&lt;br /&gt;
== 关于 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Jedis ===&lt;br /&gt;
'''Jedis''' 是Java 实现的Redis 客户端，它的 API 提供了全面的类似于 Redis 原生命令的支持。'''相比于其他 Redis 封装框架更加原生'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
特点：&lt;br /&gt;
* Jedis 中的方法调用是比较底层的暴露的 Redis 的 API，也即 Jedis 中的 Java '''方法基本和 Redis 的 API 保持着一致'''，了解 Redis 的 API，也就能熟练的使用 Jedis。&lt;br /&gt;
** Jedis 仅支持基本的数据类型如：String、Hash、List、Set、Sorted Set。&lt;br /&gt;
** 支持单机、哨兵、Cluster等部署模式，支持事务、pipeline（管道技术）、LUA脚本等。&lt;br /&gt;
* Jedis 使用'''阻塞的I/O'''（'''BIO'''），且其方法调用都是'''同步'''的。（程序流需要等到 sockets 处理完I/O才能执行）&lt;br /&gt;
* Jedis 客户端实例'''不是线程安全'''的，所以需要通过'''连接池'''来使用Jedis。&lt;br /&gt;
* 不支持读写分离，需要自己实现。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
它的使用主要是使用 JedisPool：&lt;br /&gt;
# 初始化：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
    // 创建JedisPool所需的连接池配置&lt;br /&gt;
    JedisPoolConfig poolConfig = new JedisPoolConfig();&lt;br /&gt;
 &lt;br /&gt;
    // 最大连接数，默认8&lt;br /&gt;
    poolConfig.setMaxTotal(1024);&lt;br /&gt;
    // 最大空闲数，默认8&lt;br /&gt;
    poolConfig.setMaxIdle(100);&lt;br /&gt;
    // 是否启用pool的jmx管理功能, 默认true&lt;br /&gt;
    poolConfig.setJmxEnabled(true);&lt;br /&gt;
 &lt;br /&gt;
    // 创建JedisPool连接池&lt;br /&gt;
    jedisPool = new JedisPool(poolConfig, HOST, PORT, TIMEOUT, PASSWORD);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# demo：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
    * 同步获取Jedis&lt;br /&gt;
    * @return&lt;br /&gt;
    */&lt;br /&gt;
    public synchronized static Jedis getJedis(){&lt;br /&gt;
        if(jedisPool != null){&lt;br /&gt;
            //获取Jedis对象&lt;br /&gt;
            Jedis jedis = jedisPool.getResource();&lt;br /&gt;
            return jedis;&lt;br /&gt;
        }&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
    * 释放jedis资源&lt;br /&gt;
    */&lt;br /&gt;
    public static void releaseResource(Jedis jedis){&lt;br /&gt;
        if( jedis !=null ){&lt;br /&gt;
            jedis.close();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Redisson ===&lt;br /&gt;
'''Redisson''' 实现了分布式和可扩展的Java数据结构，和Jedis相比，功能较为简单，不支持字符串操作，不支持排序、事务、管道、分区等Redis特性。&lt;br /&gt;
* Redisson 的宗旨是促进使用者对Redis的关注分离，从而让使用者能够将精力更集中地放在处理业务逻辑上。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
特点：&lt;br /&gt;
* 提供'''分布式锁'''等常见的'''操作封装'''，并实现了分布式和可扩展的Java数据结构，但'''不支持一些基础的 Redis 原生功能'''。&lt;br /&gt;
** Redisson 不仅提供了一系列的分布式 Java 常用对象，基本可以与 Java 的基本数据结构通用，还提供了许多'''分布式服务'''，其中包括（BitSet, Set, Multimap, SortedSet, Map, List, Queue, BlockingQueue, Deque, BlockingDeque, Semaphore, Lock, AtomicLong, CountDownLatch, Publish / Subscribe, Bloom filter, Remote service, Spring cache, Executor service, Live Object service, Scheduler service）。&lt;br /&gt;
** 不支持事务操作，可以使用 LUA 脚本实现。&lt;br /&gt;
* 基于 '''Netty''' 实现，采用'''非阻塞的I/O'''（'''AIO'''），性能高，支持异步的请求。&lt;br /&gt;
* Redisson 的 API 是'''线程安全'''的，所以可以操作单个 Redisson 连接来完成各种操作。&lt;br /&gt;
* 支持连接池。&lt;br /&gt;
* 支持在主从部署和 cluster 部署模式下的'''读写分离'''。&lt;br /&gt;
** 在此基础上，'''支持读操作负载均衡'''。&lt;br /&gt;
* 第三方框架整合：&lt;br /&gt;
** Redisson 提供了和 Spring 框架的各项特性类似的，以Spring XML的命名空间的方式配置RedissonClient实例和它所支持的所有对象和服务；&lt;br /&gt;
** Redisson 完整的实现了 Spring 框架里的缓存机制；&lt;br /&gt;
** Redisson 在 Redis 的基础上实现了 Java 缓存标准规范；&lt;br /&gt;
** Redisson 为 Apache Tomcat 集群提供了基于 Redis 的非黏性会话管理功能。该功能支持 Apache Tomcat 的6、7和8版。&lt;br /&gt;
** Redisson 还提供了 Spring Session 会话管理器的实现。&lt;br /&gt;
&lt;br /&gt;
demo：&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
    //创建配置  &lt;br /&gt;
    Config config = new Config();  &lt;br /&gt;
  &lt;br /&gt;
    //指定编码，默认编码为org.redisson.codec.JsonJacksonCodec   &lt;br /&gt;
    config.setCodec(new org.redisson.client.codec.StringCodec());  &lt;br /&gt;
  &lt;br /&gt;
    //指定使用单节点部署方式  &lt;br /&gt;
    config.useSingleServer().setAddress(&amp;quot;redis://127.0.0.1:6379&amp;quot;);  &lt;br /&gt;
    config.useSingleServer().setClientName(&amp;quot;root&amp;quot;);&lt;br /&gt;
    config.useSingleServer().setPassword(&amp;quot;abcabc&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
    //创建redisson客户端&lt;br /&gt;
    RedissonClient redisson = Redisson.create(config);  &lt;br /&gt;
 &lt;br /&gt;
    RBucket&amp;lt;String&amp;gt; keyObject = redisson.getBucket(&amp;quot;key&amp;quot;);  &lt;br /&gt;
    keyObject.set(&amp;quot;value&amp;quot;);  &lt;br /&gt;
 &lt;br /&gt;
    //关闭RedissonClient  &lt;br /&gt;
    redisson.shutdown();  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lettuce ===&lt;br /&gt;
'''Lettuce''' 是目前 springboot 默认使用的客户端。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
特点：&lt;br /&gt;
* 基于 '''Netty''' 框架的事件驱动的通信层，其方法调用是'''异步'''的。&lt;br /&gt;
* Lettuce 的 API 是'''线程安全'''的，所以可以操作单个 Lettuce 连接来完成各种操作。&lt;br /&gt;
* 不需要考虑线程池，性能比较高，Spring 生态默认。&lt;br /&gt;
* 同样支持连接池。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
demo：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
RedisClient client = RedisClient.create(&amp;quot;redis://localhost&amp;quot;); &lt;br /&gt;
StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect(); &lt;br /&gt;
RedisStringCommands sync = connection.sync(); &lt;br /&gt;
String value = sync.get(&amp;quot;key&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
//////////////////// &lt;br /&gt;
StatefulRedisConnection&amp;lt;String, String&amp;gt; connection = client.connect(); &lt;br /&gt;
RedisStringAsyncCommands&amp;lt;String, String&amp;gt; async = connection.async(); &lt;br /&gt;
RedisFuture&amp;lt;String&amp;gt; set = async.set(&amp;quot;key&amp;quot;, &amp;quot;value&amp;quot;) &lt;br /&gt;
RedisFuture&amp;lt;String&amp;gt; get = async.get(&amp;quot;key&amp;quot;) &lt;br /&gt;
 &lt;br /&gt;
async.awaitAll(set, get) == true &lt;br /&gt;
 &lt;br /&gt;
set.get() == &amp;quot;OK&amp;quot; &lt;br /&gt;
get.get() == &amp;quot;value&amp;quot; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>