{"id":277,"date":"2014-08-26T13:51:12","date_gmt":"2014-08-26T13:51:12","guid":{"rendered":"http:\/\/blog.yyhcw.com\/post\/277.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T07:54:17","slug":"redis-cmd","status":"publish","type":"post","link":"http:\/\/blog.yyhcw.com\/post\/277.html","title":{"rendered":"redis \u547d\u4ee4\u884c \u64cd\u4f5c"},"content":{"rendered":"<p>redis\u76ee\u524d\u63d0\u4f9b\u56db\u79cd\u6570\u636e\u7c7b\u578b\uff1astring,list,set\u53cazset(sorted set)\u3002<br \/>* string\u662f\u6700\u7b80\u5355\u7684\u7c7b\u578b\uff0c\u4f60\u53ef\u4ee5\u7406\u89e3\u6210\u4e0eMemcached\u4e00\u6a21\u4e00\u4e2a\u7684\u7c7b\u578b\uff0c\u4e00\u4e2akey\u5bf9\u5e94\u4e00\u4e2avalue\uff0c\u5176\u4e0a\u652f\u6301\u7684\u64cd\u4f5c\u4e0eMemcached\u7684\u64cd\u4f5c\u7c7b\u4f3c\u3002\u4f46\u5b83\u7684\u529f\u80fd\u66f4\u4e30\u5bcc\u3002<br \/>* list\u662f\u4e00\u4e2a\u94fe\u8868\u7ed3\u6784\uff0c\u4e3b\u8981\u529f\u80fd\u662fpush\u3001pop\u3001\u83b7\u53d6\u4e00\u4e2a\u8303\u56f4\u7684\u6240\u6709\u503c\u7b49\u7b49\u3002\u64cd\u4f5c\u4e2dkey\u7406\u89e3\u4e3a\u94fe\u8868\u7684\u540d\u5b57\u3002<br \/>* set\u662f\u96c6\u5408\uff0c\u548c\u6211\u4eec\u6570\u5b66\u4e2d\u7684\u96c6\u5408\u6982\u5ff5\u76f8\u4f3c\uff0c\u5bf9\u96c6\u5408\u7684\u64cd\u4f5c\u6709\u6dfb\u52a0\u5220\u9664\u5143\u7d20\uff0c\u6709\u5bf9\u591a\u4e2a\u96c6\u5408\u6c42\u4ea4\u5e76\u5dee\u7b49\u64cd\u4f5c\u3002\u64cd\u4f5c\u4e2dkey\u7406\u89e3\u4e3a\u96c6\u5408\u7684\u540d\u5b57\u3002<br \/>* zset\u662fset\u7684\u4e00\u4e2a\u5347\u7ea7\u7248\u672c\uff0c\u4ed6\u5728set\u7684\u57fa\u7840\u4e0a\u589e\u52a0\u4e86\u4e00\u4e2a\u987a\u5e8f\u5c5e\u6027\uff0c\u8fd9\u4e00\u5c5e\u6027\u5728\u6dfb\u52a0\u4fee\u6539\u5143\u7d20\u7684\u65f6\u5019\u53ef\u4ee5\u6307\u5b9a\uff0c\u6bcf\u6b21\u6307\u5b9a\u540e\uff0czset\u4f1a\u81ea\u52a8\u91cd\u65b0\u6309\u65b0\u7684\u503c\u8c03\u6574\u987a\u5e8f\u3002\u53ef\u4ee5\u7406\u89e3\u4e86\u6709\u4e24\u5217\u7684mysql\u8868\uff0c\u4e00\u5217\u5b58value\uff0c\u4e00\u5217\u5b58\u987a\u5e8f\u3002\u64cd\u4f5c\u4e2dkey\u7406\u89e3\u4e3azset\u7684\u540d\u5b57\u3002<br \/>\u5176\u4e2dstring\u7c7b\u578b\u8fd8\u5305\u62echash\u7c7b\u578b\u3002<\/p>\n<p><span id=\"more-1442\"><\/span><strong>1\uff0c\u9002\u5408\u5168\u4f53\u7c7b\u578b\u7684\u547d\u4ee4<\/strong><\/p>\n<p>EXISTS key \u5224\u65ad\u4e00\u4e2a\u952e\u662f\u5426\u5b58\u5728;\u5b58\u5728\u8fd4\u56de 1;\u5426\u5219\u8fd4\u56de0;<br \/>DEL key \u5220\u9664\u67d0\u4e2akey,\u6216\u662f\u4e00\u7cfb\u5217key;DEL key1 key2 key3 key4<br \/>TYPE key \u8fd4\u56de\u67d0\u4e2akey\u5143\u7d20\u7684\u6570\u636e\u7c7b\u578b ( none:\u4e0d\u5b58\u5728,string:\u5b57\u7b26,list,set,zset,hash)<br \/>KEYS pattern \u8fd4\u56de\u5339\u914d\u7684key\u5217\u8868 (KEYS foo*:\u67e5\u627efoo\u5f00\u5934\u7684keys)<br \/>RANDOMKEY \u968f\u673a\u83b7\u5f97\u4e00\u4e2a\u5df2\u7ecf\u5b58\u5728\u7684key\uff0c\u5982\u679c\u5f53\u524d\u6570\u636e\u5e93\u4e3a\u7a7a\uff0c\u5219\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32<br \/>RENAME oldname newname\u66f4\u6539key\u7684\u540d\u5b57\uff0c\u65b0\u952e\u5982\u679c\u5b58\u5728\u5c06\u88ab\u8986\u76d6<br \/>RENAMENX oldname newname \u66f4\u6539key\u7684\u540d\u5b57\uff0c\u5982\u679c\u540d\u5b57\u5b58\u5728\u5219\u66f4\u6539\u5931\u8d25<br \/>DBSIZE\u8fd4\u56de\u5f53\u524d\u6570\u636e\u5e93\u7684key\u7684\u603b\u6570<br \/>EXPIRE\u8bbe\u7f6e\u67d0\u4e2akey\u7684\u8fc7\u671f\u65f6\u95f4\uff08\u79d2\uff09,(EXPIRE bruce 1000\uff1a\u8bbe\u7f6ebruce\u8fd9\u4e2akey1000\u79d2\u540e\u7cfb\u7edf\u81ea\u52a8\u5220\u9664)\u6ce8\u610f\uff1a\u5982\u679c\u5728\u8fd8\u6ca1\u6709\u8fc7\u671f\u7684\u65f6\u5019\uff0c\u5bf9\u503c\u8fdb\u884c\u4e86\u6539\u53d8\uff0c\u90a3\u4e48\u90a3\u4e2a\u503c\u4f1a\u88ab\u6e05\u9664\u3002<br \/>TTL\u67e5\u627e\u67d0\u4e2akey\u8fd8\u6709\u591a\u957f\u65f6\u95f4\u8fc7\u671f,\u8fd4\u56de\u65f6\u95f4\u79d2<br \/>SELECT index \u9009\u62e9\u6570\u636e\u5e93<br \/>MOVE key dbindex \u5c06\u6307\u5b9a\u952e\u4ece\u5f53\u524d\u6570\u636e\u5e93\u79fb\u5230\u76ee\u6807\u6570\u636e\u5e93 dbindex\u3002\u6210\u529f\u8fd4\u56de 1;\u5426\u5219\u8fd4\u56de0\uff08\u6e90\u6570\u636e\u5e93\u4e0d\u5b58\u5728key\u6216\u76ee\u6807\u6570\u636e\u5e93\u5df2\u5b58\u5728\u540c\u540dkey\uff09;<br \/>FLUSHDB \u6e05\u7a7a\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u952e<br \/>FLUSHALL \u6e05\u7a7a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u952e<\/p>\n<p><strong>2\uff0c\u5904\u7406\u5b57\u7b26\u4e32\u7684\u547d\u4ee4<\/strong><\/p>\n<p>SET key value \u7ed9\u4e00\u4e2a\u952e\u8bbe\u7f6e\u5b57\u7b26\u4e32\u503c\u3002SET keyname datalength data (SET bruce 10 paitoubing:\u4fdd\u5b58key\u4e3aburce,\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a10\u7684\u4e00\u4e2a\u5b57\u7b26\u4e32paitoubing\u5230\u6570\u636e\u5e93)\uff0cdata\u6700\u5927\u4e0d\u53ef\u8d85\u8fc71G\u3002<br \/>GET key\u83b7\u53d6\u67d0\u4e2akey \u7684value\u503c\u3002\u5982key\u4e0d\u5b58\u5728\uff0c\u5219\u8fd4\u56de\u5b57\u7b26\u4e32\u201dnil\u201d\uff1b\u5982key\u7684\u503c\u4e0d\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u3002<br \/>GETSET key value\u53ef\u4ee5\u7406\u89e3\u6210\u83b7\u5f97\u7684key\u7684\u503c\u7136\u540eSET\u8fd9\u4e2a\u503c\uff0c\u66f4\u52a0\u65b9\u4fbf\u7684\u64cd\u4f5c (SET bruce 10 paitoubing,\u8fd9\u4e2a\u65f6\u5019\u9700\u8981\u4fee\u6539bruce\u53d8\u62101234567890\u5e76\u83b7\u53d6\u8fd9\u4e2a\u4ee5\u524d\u7684\u6570\u636epaitoubing,GETSET bruce 10 1234567890)<br \/>MGET key1 key2 \u2026 keyN \u4e00\u6b21\u6027\u8fd4\u56de\u591a\u4e2a\u952e\u7684\u503c<br \/>SETNX key value SETNX\u4e0eSET\u7684\u533a\u522b\u662fSET\u53ef\u4ee5\u521b\u5efa\u4e0e\u66f4\u65b0key\u7684value\uff0c\u800cSETNX\u662f\u5982\u679ckey\u4e0d\u5b58\u5728\uff0c\u5219\u521b\u5efakey\u4e0evalue\u6570\u636e<br \/>MSET key1 value1 key2 value2 \u2026 keyN valueN \u5728\u4e00\u6b21\u539f\u5b50\u64cd\u4f5c\u4e0b\u4e00\u6b21\u6027\u8bbe\u7f6e\u591a\u4e2a\u952e\u548c\u503c<br \/>MSETNX key1 value1 key2 value2 \u2026 keyN valueN \u5728\u4e00\u6b21\u539f\u5b50\u64cd\u4f5c\u4e0b\u4e00\u6b21\u6027\u8bbe\u7f6e\u591a\u4e2a\u952e\u548c\u503c\uff08\u76ee\u6807\u952e\u4e0d\u5b58\u5728\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6709\u4e00\u4e2a\u4ee5\u4e0a\u7684key\u5df2\u5b58\u5728\uff0c\u5219\u5931\u8d25\uff09<br \/>INCR key \u81ea\u589e\u952e\u503c<br \/>INCRBY key integer \u4ee4\u952e\u503c\u81ea\u589e\u6307\u5b9a\u6570\u503c<br \/>DECR key \u81ea\u51cf\u952e\u503c<br \/>DECRBY key integer \u4ee4\u952e\u503c\u81ea\u51cf\u6307\u5b9a\u6570\u503c<\/p>\n<p><strong>3\uff0c\u5904\u7406 lists \u7684\u547d\u4ee4<\/strong><\/p>\n<p>RPUSH key value \u4ece List \u5c3e\u90e8\u6dfb\u52a0\u4e00\u4e2a\u5143\u7d20\uff08\u5982\u5e8f\u5217\u4e0d\u5b58\u5728\uff0c\u5219\u5148\u521b\u5efa\uff0c\u5982\u5df2\u5b58\u5728\u540c\u540dKey\u800c\u975e\u5e8f\u5217\uff0c\u5219\u8fd4\u56de\u9519\u8bef\uff09<br \/>LPUSH key value \u4ece List \u5934\u90e8\u6dfb\u52a0\u4e00\u4e2a\u5143\u7d20<br \/>LLEN key \u8fd4\u56de\u4e00\u4e2a List \u7684\u957f\u5ea6<br \/>LRANGE key start end\u4ece\u81ea\u5b9a\u7684\u8303\u56f4\u5185\u8fd4\u56de\u5e8f\u5217\u7684\u5143\u7d20 (LRANGE testlist 0 2;\u8fd4\u56de\u5e8f\u5217testlist\u524d0 1 2\u5143\u7d20)<br \/>LTRIM key start end\u4fee\u526a\u67d0\u4e2a\u8303\u56f4\u4e4b\u5916\u7684\u6570\u636e (LTRIM testlist 0 2;\u4fdd\u75590 1 2\u5143\u7d20\uff0c\u5176\u4f59\u7684\u5220\u9664)<br \/>LINDEX key index\u8fd4\u56de\u67d0\u4e2a\u4f4d\u7f6e\u7684\u5e8f\u5217\u503c(LINDEX testlist 0;\u8fd4\u56de\u5e8f\u5217testlist\u4f4d\u7f6e\u4e3a0\u7684\u5143\u7d20)<br \/>LSET key index value\u66f4\u65b0\u67d0\u4e2a\u4f4d\u7f6e\u5143\u7d20\u7684\u503c<br \/>LREM key count value \u4ece List \u7684\u5934\u90e8\uff08count\u6b63\u6570\uff09\u6216\u5c3e\u90e8\uff08count\u8d1f\u6570\uff09\u5220\u9664\u4e00\u5b9a\u6570\u91cf\uff08count\uff09\u5339\u914dvalue\u7684\u5143\u7d20\uff0c\u8fd4\u56de\u5220\u9664\u7684\u5143\u7d20\u6570\u91cf\u3002<br \/>LPOP key \u5f39\u51fa List \u7684\u7b2c\u4e00\u4e2a\u5143\u7d20<br \/>RPOP key \u5f39\u51fa List \u7684\u6700\u540e\u4e00\u4e2a\u5143\u7d20<br \/>RPOPLPUSH srckey dstkey \u5f39\u51fa _srckey_ \u4e2d\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u5e76\u5c06\u5176\u538b\u5165 _dstkey_\u5934\u90e8\uff0ckey\u4e0d\u5b58\u5728\u6216\u5e8f\u5217\u4e3a\u7a7a\u5219\u8fd4\u56de\u201dnil\u201d<\/p>\n<p><strong>4\uff0c\u5904\u7406\u96c6\u5408(sets)\u7684\u547d\u4ee4\uff08\u6709\u7d22\u5f15\u65e0\u5e8f\u5e8f\u5217\uff09<\/strong><\/p>\n<p>SADD key member\u589e\u52a0\u5143\u7d20\u5230SETS\u5e8f\u5217,\u5982\u679c\u5143\u7d20\uff08membe\uff09\u4e0d\u5b58\u5728\u5219\u6dfb\u52a0\u6210\u529f 1\uff0c\u5426\u5219\u5931\u8d25 0;(SADD testlist 3 \\n one)<br \/>SREM key member \u5220\u9664SETS\u5e8f\u5217\u7684\u67d0\u4e2a\u5143\u7d20\uff0c\u5982\u679c\u5143\u7d20\u4e0d\u5b58\u5728\u5219\u5931\u8d250\uff0c\u5426\u5219\u6210\u529f 1(SREM testlist 3 \\N one)<br \/>SPOP key \u4ece\u96c6\u5408\u4e2d\u968f\u673a\u5f39\u51fa\u4e00\u4e2a\u6210\u5458<br \/>SMOVE srckey dstkey member \u628a\u4e00\u4e2aSETS\u5e8f\u5217\u7684\u67d0\u4e2a\u5143\u7d20\u79fb\u52a8\u5230\u53e6\u5916\u4e00\u4e2aSETS\u5e8f\u5217 (SMOVE testlist test 3\\n two;\u4ece\u5e8f\u5217testlist\u79fb\u52a8\u5143\u7d20two\u5230 test\u4e2d\uff0ctestlist\u4e2d\u5c06\u4e0d\u5b58\u5728two\u5143\u7d20)<br \/>SCARD key \u7edf\u8ba1\u67d0\u4e2aSETS\u7684\u5e8f\u5217\u7684\u5143\u7d20\u6570\u91cf<br \/>SISMEMBER key member \u83b7\u77e5\u6307\u5b9a\u6210\u5458\u662f\u5426\u5b58\u5728\u4e8e\u96c6\u5408\u4e2d<br \/>SINTER key1 key2 \u2026 keyN \u8fd4\u56de key1, key2, \u2026, keyN \u4e2d\u7684\u4ea4\u96c6<br \/>SINTERSTORE dstkey key1 key2 \u2026 keyN \u5c06 key1, key2, \u2026, keyN \u4e2d\u7684\u4ea4\u96c6\u5b58\u5165 dstkey<br \/>SUNION key1 key2 \u2026 keyN \u8fd4\u56de key1, key2, \u2026, keyN \u7684\u5e76\u96c6<br \/>SUNIONSTORE dstkey key1 key2 \u2026 keyN \u5c06 key1, key2, \u2026, keyN \u7684\u5e76\u96c6\u5b58\u5165 dstkey<br \/>SDIFF key1 key2 \u2026 keyN \u4f9d\u636e key2, \u2026, keyN \u6c42 key1 \u7684\u5dee\u96c6\u3002\u5b98\u65b9\u4f8b\u5b50\uff1a<br \/>key1 = x,a,b,c<br \/>key2 = c<br \/>key3 = a,d<br \/>SDIFF key1,key2,key3 =&gt; x,b<br \/>SDIFFSTORE dstkey key1 key2 \u2026 keyN \u4f9d\u636e key2, \u2026, keyN \u6c42 key1 \u7684\u5dee\u96c6\u5e76\u5b58\u5165 dstkey<br \/>SMEMBERS key \u8fd4\u56de\u67d0\u4e2a\u5e8f\u5217\u7684\u6240\u6709\u5143\u7d20<br \/>SRANDMEMBER key \u968f\u673a\u8fd4\u56de\u67d0\u4e2a\u5e8f\u5217\u7684\u5143\u7d20<\/p>\n<p><strong>5\uff0c\u5904\u7406\u6709\u5e8f\u96c6\u5408(sorted sets)\u7684\u547d\u4ee4 (zsets)<\/strong><\/p>\n<p>ZADD key score member \u6dfb\u52a0\u6307\u5b9a\u6210\u5458\u5230\u6709\u5e8f\u96c6\u5408\u4e2d\uff0c\u5982\u679c\u76ee\u6807\u5b58\u5728\u5219\u66f4\u65b0score\uff08\u5206\u503c\uff0c\u6392\u5e8f\u7528\uff09<br \/>ZREM key member \u4ece\u6709\u5e8f\u96c6\u5408\u5220\u9664\u6307\u5b9a\u6210\u5458<br \/>ZINCRBY key increment member \u5982\u679c\u6210\u5458\u5b58\u5728\u5219\u5c06\u5176\u589e\u52a0_increment_\uff0c\u5426\u5219\u5c06\u8bbe\u7f6e\u4e00\u4e2ascore\u4e3a_increment_\u7684\u6210\u5458<br \/>ZRANGE key start end \u8fd4\u56de\u5347\u5e8f\u6392\u5e8f\u540e\u7684\u6307\u5b9a\u8303\u56f4\u7684\u6210\u5458<br \/>ZREVRANGE key start end \u8fd4\u56de\u964d\u5e8f\u6392\u5e8f\u540e\u7684\u6307\u5b9a\u8303\u56f4\u7684\u6210\u5458<br \/>ZRANGEBYSCORE key min max \u8fd4\u56de\u6240\u6709\u7b26\u5408score &gt;= min\u548cscore &lt;= max\u7684\u6210\u5458 ZCARD key \u8fd4\u56de\u6709\u5e8f\u96c6\u5408\u7684\u5143\u7d20\u6570\u91cf ZSCORE key element \u8fd4\u56de\u6307\u5b9a\u6210\u5458\u7684SCORE\u503c ZREMRANGEBYSCORE key min max \u5220\u9664\u7b26\u5408 score &gt;= min \u548c score &lt;= max \u6761\u4ef6\u7684\u6240\u6709\u6210\u5458<\/p>\n<p><strong>6\uff0chash\u7c7b\u578b<\/strong><\/p>\n<p>Command &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Parameters &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Description<br \/>HSET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;key field value &nbsp; &nbsp; &nbsp; &nbsp; Set the hash field to the specified value. Creates the hash if needed.<br \/>HGET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;key field &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Retrieve the value of the specified hash field.<br \/>HMGET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key field1 \u2026 fieldN &nbsp; Get the hash values associated to the specified fields.<br \/>HMSET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key field1 value1 \u2026 fieldN valueN &nbsp; &nbsp; Set the hash fields to their respective values.<br \/>HINCRBY &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;key field integer &nbsp; &nbsp; &nbsp; Increment the integer value of the hash at key on field with integer.<br \/>HEXISTS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;key field &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Test for existence of a specified field in a hash<br \/>HDEL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key field &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Remove the specified field from a hash<br \/>HLEN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return the number of items in a hash.<br \/>HKEYS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return all the fields in a hash.<br \/>HVALS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return all the values in a hash.<br \/>HGETALL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return all the fields and associated values in a hash.<\/p>\n<p><strong>7\uff0c\u6392\u5e8f\uff08List, Set, Sorted Set\uff09<\/strong><\/p>\n<p>SORT key BY pattern LIMIT start end GET pattern ASC|DESC ALPHA \u6309\u7167\u6307\u5b9a\u6a21\u5f0f\u6392\u5e8f\u96c6\u5408\u6216List<br \/>SORT mylist DESC \u964d\u5e8f<br \/>SORT mylist LIMIT 0 10 \u4ece\u5e8f\u53f70\u5f00\u59cb\uff0c\u53d610\u6761<br \/>SORT mylist LIMIT 0 10 ALPHA DESC \u6309\u9996\u5b57\u7b26\u6392\u5e8f<br \/>SORT mylist BY weight_* STORE resultkey \u5c06\u8fd4\u56de\u7684\u7ed3\u679c\u5b58\u653e\u4e8eresultkey\u5e8f\u5217\uff08List\uff09<\/p>\n<p><strong>8\uff0c\u6301\u4e45\u63a7\u5236<\/strong><\/p>\n<p>SAVE \u540c\u6b65\u4fdd\u5b58\u6570\u636e\u5230\u78c1\u76d8<br \/>BGSAVE \u5f02\u6b65\u4fdd\u5b58\u6570\u636e\u5230\u78c1\u76d8<br \/>LASTSAVE \u8fd4\u56de\u4e0a\u6b21\u6210\u529f\u4fdd\u5b58\u5230\u78c1\u76d8\u7684Unix\u65f6\u95f4\u6233<br \/>SHUTDOWN \u540c\u6b65\u4fdd\u5b58\u5230\u670d\u52a1\u5668\u5e76\u5173\u95ed Redis \u670d\u52a1\u5668\uff08SAVE+QUIT\uff09<br \/>BGREWRITEAOF \u5f53\u65e5\u5fd7\u6587\u4ef6\u8fc7\u957f\u65f6\u91cd\u5199\u65e5\u5fd7\u6587\u4ef6<\/p>\n<p><strong>9\uff0c\u8fdc\u7a0b\u63a7\u5236\u547d\u4ee4<\/strong><\/p>\n<p>INFO \u63d0\u4f9b\u670d\u52a1\u5668\u7684\u4fe1\u606f\u548c\u7edf\u8ba1\u4fe1\u606f<br \/>MONITOR \u5b9e\u65f6\u8f93\u51fa\u6240\u6709\u6536\u5230\u7684\u8bf7\u6c42<br \/>SLAVEOF \u4fee\u6539\u590d\u5236\u9009\u9879<\/p>\n","protected":false},"excerpt":{"rendered":"redis\u76ee\u524d\u63d0\u4f9b\u56db\u79cd\u6570\u636e\u7c7b\u578b\uff1astring,list,set\u53cazset(sorted set)\u3002* stri \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"views":252,"_links":{"self":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/277"}],"collection":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/comments?post=277"}],"version-history":[{"count":0,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/277\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}