]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> | |
3 | <html> | |
4 | <head> | |
5 | <link type="text/css" rel="stylesheet" href="style.css" /> | |
6 | </head> | |
7 | <body> | |
8 | <div id="page"> | |
9 | ||
10 | <div id='header'> | |
11 | <a href="index.html"> | |
12 | <img style="border:none" alt="Redis Documentation" src="redis.png"> | |
13 | </a> | |
14 | </div> | |
15 | ||
16 | <div id="pagecontent"> | |
17 | <div class="index"> | |
18 | <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. --> | |
19 | <b>MsetCommand: Contents</b><br> <a href="#MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >">MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis ></a><br> <a href="#MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >">MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis ></a><br> <a href="#MSET Return value">MSET Return value</a><br> <a href="#MSETNX Return value">MSETNX Return value</a> | |
20 | </div> | |
21 | ||
22 | <h1 class="wikiname">MsetCommand</h1> | |
23 | ||
24 | <div class="summary"> | |
25 | ||
26 | </div> | |
27 | ||
28 | <div class="narrow"> | |
29 | #sidebar <a href="StringCommandsSidebar.html">StringCommandsSidebar</a><h1><a name="MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >">MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis ></a></h1> 1.1) = | |
30 | <h1><a name="MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >">MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis ></a></h1> 1.1) = | |
31 | <i>Time complexity: O(1) to set every key</i><blockquote>Set the the respective keys to the respective values. MSET will replace oldvalues with new values, while MSETNX will not perform any operation at alleven if just a single key already exists.</blockquote> | |
32 | <blockquote>Because of this semantic MSETNX can be used in order to set different keysrepresenting different fields of an unique logic object in a way thatensures that either all the fields or none at all are set.</blockquote> | |
33 | <blockquote>Both MSET and MSETNX are atomic operations. This means that for instanceif the keys A and B are modified, another client talking to Redis can eithersee the changes to both A and B at once, or no modification at all.</blockquote> | |
34 | <h2><a name="MSET Return value">MSET Return value</a></h2><a href="ReplyTypes.html">Status code reply</a> Basically +OK as MSET can't fail<h2><a name="MSETNX Return value">MSETNX Return value</a></h2><a href="ReplyTypes.html">Integer reply</a>, specifically:<br/><br/><pre class="codeblock python" name="code"> | |
35 | 1 if the all the keys were set | |
36 | 0 if no key was set (at least one key already existed) | |
37 | </pre> | |
38 | </div> | |
39 | ||
40 | </div> | |
41 | </div> | |
42 | </body> | |
43 | </html> | |
44 |