{"id":53094,"date":"2025-08-12T00:19:51","date_gmt":"2025-08-11T16:19:51","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/53094.html"},"modified":"2025-08-12T00:19:51","modified_gmt":"2025-08-11T16:19:51","slug":"redis-%e5%a4%a7%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e5%ae%9e%e6%88%98%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/53094.html","title":{"rendered":"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3"},"content":{"rendered":"<h2>Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3<\/h2>\n<p>Redis \u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u952e\u503c\u7f13\u5b58\u7cfb\u7edf&#xff0c;\u5176\u5f3a\u5927\u7684 \u4e30\u5bcc\u6570\u636e\u7ed3\u6784 \u662f\u5b83\u5728\u73b0\u4ee3\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u5e7f\u6cdb\u5e94\u7528\u7684\u6838\u5fc3\u539f\u56e0\u3002\u76f8\u6bd4\u4f20\u7edf\u952e\u503c\u5b58\u50a8\u4ec5\u652f\u6301\u5b57\u7b26\u4e32&#xff0c;Redis \u63d0\u4f9b\u4e86\u591a\u79cd\u201c\u5927\u6570\u636e\u7c7b\u578b\u201d&#xff08;Data Structures&#xff09;&#xff0c;\u6bcf\u79cd\u7ed3\u6784\u9488\u5bf9\u7279\u5b9a\u4e1a\u52a1\u573a\u666f\u8fdb\u884c\u4e86\u9ad8\u5ea6\u4f18\u5316\u3002<\/p>\n<p>\u672c\u6587\u5c06\u7cfb\u7edf\u6027\u5730\u4ecb\u7ecd Redis \u7684 5 \u5927\u6838\u5fc3\u6570\u636e\u7c7b\u578b \u53ca\u5176\u6269\u5c55\u7c7b\u578b&#xff0c;\u7ed3\u5408\u771f\u5b9e\u5e94\u7528\u573a\u666f\u3001\u547d\u4ee4\u7528\u6cd5\u548c\u6700\u4f73\u5b9e\u8df5&#xff0c;\u5e2e\u52a9\u4f60\u638c\u63e1 Redis \u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u9ad8\u7ea7\u7528\u6cd5\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001Redis \u652f\u6301\u7684\u6570\u636e\u7c7b\u578b\u6982\u89c8<\/h3>\n<table>\n<tr>\u6570\u636e\u7c7b\u578b\u7ed3\u6784\u7279\u70b9\u5178\u578b\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>&#x1f7e0; String<\/td>\n<td>\u6700\u57fa\u7840\u7c7b\u578b&#xff0c;\u4e8c\u8fdb\u5236\u5b89\u5168<\/td>\n<td>\u7f13\u5b58\u3001\u8ba1\u6570\u5668\u3001\u5206\u5e03\u5f0f\u9501<\/td>\n<\/tr>\n<tr>\n<td>&#x1f7e1; Hash<\/td>\n<td>\u952e\u503c\u5bf9\u96c6\u5408&#xff08;field-value&#xff09;<\/td>\n<td>\u5b58\u50a8\u5bf9\u8c61&#xff08;\u5982\u7528\u6237\u4fe1\u606f&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#x1f535; List<\/td>\n<td>\u6709\u5e8f\u3001\u53ef\u91cd\u590d\u7684\u961f\u5217<\/td>\n<td>\u6d88\u606f\u961f\u5217\u3001\u6700\u65b0\u52a8\u6001<\/td>\n<\/tr>\n<tr>\n<td>&#x1f534; Set<\/td>\n<td>\u65e0\u5e8f\u3001\u552f\u4e00\u5143\u7d20\u96c6\u5408<\/td>\n<td>\u6807\u7b7e\u3001\u597d\u53cb\u5173\u7cfb\u3001\u53bb\u91cd<\/td>\n<\/tr>\n<tr>\n<td>&#x1f7e3; Sorted Set&#xff08;ZSet&#xff09;<\/td>\n<td>\u6709\u5e8f\u96c6\u5408&#xff08;score \u6392\u5e8f&#xff09;<\/td>\n<td>\u6392\u884c\u699c\u3001\u5ef6\u8fdf\u961f\u5217<\/td>\n<\/tr>\n<tr>\n<td>\u26aa Bitmap<\/td>\n<td>\u4f4d\u6570\u7ec4<\/td>\n<td>\u7528\u6237\u7b7e\u5230\u3001\u6d3b\u8dc3\u7edf\u8ba1<\/td>\n<\/tr>\n<tr>\n<td>&#x1f30d; Geo<\/td>\n<td>\u5730\u7406\u4f4d\u7f6e\u5750\u6807<\/td>\n<td>\u9644\u8fd1\u7684\u4eba\u3001LBS \u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>&#x1f4ca; HyperLogLog<\/td>\n<td>\u57fa\u6570\u4f30\u7b97<\/td>\n<td>UV \u7edf\u8ba1<\/td>\n<\/tr>\n<tr>\n<td>&#x1f4e5; Stream<\/td>\n<td>\u65e5\u5fd7\u6d41\u7ed3\u6784<\/td>\n<td>\u6d88\u606f\u961f\u5217\u3001\u4e8b\u4ef6\u6d41<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u2705 \u6240\u6709\u7c7b\u578b\u90fd\u652f\u6301\u8fc7\u671f\u65f6\u95f4&#xff08;TTL&#xff09;\u3001\u539f\u5b50\u64cd\u4f5c\u548c\u9ad8\u6027\u80fd\u8bfb\u5199\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5404\u5927\u6570\u636e\u7c7b\u578b\u7684\u5b9e\u6218\u8be6\u89e3<\/h3>\n<hr \/>\n<h4>1. String&#xff1a;\u6700\u57fa\u7840\u4f46\u6700\u5e38\u7528<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u4e8c\u8fdb\u5236\u5b89\u5168&#xff0c;\u6700\u5927\u652f\u6301 512MB<\/li>\n<li>\u652f\u6301\u81ea\u589e\/\u81ea\u51cf\u3001\u8ffd\u52a0\u3001\u4f4d\u64cd\u4f5c\u7b49<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>SET user:1001 <span class=\"token string\">&#034;{&#039;name&#039;: &#039;Alice&#039;}&#034;<\/span><br \/>\nGET user:1001<\/p>\n<p>INCR counter:page_view     <span class=\"token comment\"># \u8bbf\u95ee\u91cf&#043;1<\/span><br \/>\nDECRBY stock <span class=\"token number\">10<\/span>            <span class=\"token comment\"># \u5e93\u5b58\u51cf10<\/span><\/p>\n<p>APPEND log <span class=\"token string\">&#034;new line<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>&#034;<\/span>    <span class=\"token comment\"># \u8ffd\u52a0\u5185\u5bb9<\/span><br \/>\nGETRANGE user:1001 <span class=\"token number\">0<\/span> <span class=\"token number\">9<\/span>     <span class=\"token comment\"># \u622a\u53d6\u5b57\u7b26\u4e32<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u7f13\u5b58\u70ed\u70b9\u6570\u636e&#xff08;\u9875\u9762\u3001\u7528\u6237\u4fe1\u606f&#xff09;<\/li>\n<li>\u8ba1\u6570\u5668&#xff08;PV\u3001UV\u3001\u5e93\u5b58&#xff09;<\/li>\n<li>\u5206\u5e03\u5f0f\u9501&#xff08;SET key value NX EX 10&#xff09;<\/li>\n<li>\u5171\u4eab Session&#xff08;SET session:abc &#034;user_id&#061;123&#034;&#xff09;<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u907f\u514d\u5b58\u50a8\u8fc7\u5927\u7684 String&#xff08;&gt;1MB&#xff09;&#xff0c;\u5f71\u54cd\u7f51\u7edc\u4f20\u8f93\u548c\u963b\u585e\u4e3b\u7ebf\u7a0b<\/li>\n<li>\u5927\u5bf9\u8c61\u5efa\u8bae\u62c6\u5206\u6216\u4f7f\u7528\u538b\u7f29<\/li>\n<\/ul>\n<hr \/>\n<h4>2. Hash&#xff1a;\u5b58\u50a8\u5bf9\u8c61\u7684\u7406\u60f3\u9009\u62e9<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u7c7b\u4f3c\u4e8e Map&#xff0c;\u9002\u5408\u5b58\u50a8\u5bf9\u8c61\u7684\u591a\u4e2a\u5b57\u6bb5<\/li>\n<li>\u8282\u7701\u5185\u5b58&#xff08;\u76f8\u6bd4\u591a\u4e2a String&#xff09;<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>HSET user:1001 name Alice age <span class=\"token number\">25<\/span> city Beijing<br \/>\nHGET user:1001 name<br \/>\nHMGET user:1001 name age city<br \/>\nHGETALL user:1001<br \/>\nHINCRBY user:1001 age <span class=\"token number\">1<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u7528\u6237\u8d44\u6599\u3001\u5546\u54c1\u4fe1\u606f\u3001\u914d\u7f6e\u9879\u5b58\u50a8<\/li>\n<li>\u66ff\u4ee3\u591a\u4e2a String \u5b58\u50a8\u5bf9\u8c61\u5b57\u6bb5&#xff0c;\u51cf\u5c11 key \u6570\u91cf<\/li>\n<\/ul>\n<h5>\u2705 \u4f18\u52bf&#xff1a;<\/h5>\n<ul>\n<li>\u53ef\u4ee5\u5355\u72ec\u66f4\u65b0\u67d0\u4e2a field&#xff0c;\u65e0\u9700\u8bfb\u53d6\u6574\u4e2a\u5bf9\u8c61<\/li>\n<li>\u5185\u5b58\u6548\u7387\u9ad8&#xff08;\u5c24\u5176\u662f\u5c0f\u5bf9\u8c61&#xff09;<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u5355\u4e2a Hash \u4e2d field \u6570\u91cf\u4e0d\u5b9c\u8fc7\u591a&#xff08;\u5efa\u8bae &lt; 1\u4e07&#xff09;<\/li>\n<li>\u5927 Hash \u53ef\u80fd\u5bfc\u81f4\u963b\u585e&#xff0c;\u53ef\u8003\u8651\u5206\u7247&#xff08;\u5982 user:1001:profile:1, user:1001:profile:2&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h4>3. List&#xff1a;\u53cc\u5411\u94fe\u8868&#xff0c;\u5b9e\u73b0\u961f\u5217\/\u6808<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u6709\u5e8f\u3001\u53ef\u91cd\u590d\u3001\u652f\u6301\u4ece\u4e24\u7aef\u64cd\u4f5c<\/li>\n<li>\u5e95\u5c42\u4e3a\u53cc\u5411\u94fe\u8868&#xff08;Redis 7.0&#043; \u4f18\u5316\u4e3a Packed List&#xff09;<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>LPUSH news:latest <span class=\"token string\">&#034;article_1&#034;<\/span><br \/>\nRPUSH news:latest <span class=\"token string\">&#034;article_2&#034;<\/span><br \/>\nLRANGE news:latest <span class=\"token number\">0<\/span> <span class=\"token number\">9<\/span>     <span class=\"token comment\"># \u83b7\u53d6\u524d10\u6761<\/span><\/p>\n<p>LPOP queue                 <span class=\"token comment\"># \u6d88\u8d39\u4efb\u52a1<\/span><br \/>\nRPOP queue<\/p>\n<p>BLPOP queue <span class=\"token number\">5<\/span>              <span class=\"token comment\"># \u963b\u585e\u5f0f\u5f39\u51fa&#xff08;\u8d85\u65f65\u79d2&#xff09;<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u6d88\u606f\u961f\u5217&#xff08;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b&#xff09;<\/li>\n<li>\u6700\u65b0\u52a8\u6001\/\u670b\u53cb\u5708&#xff08;LPUSH &#043; LRANGE&#xff09;<\/li>\n<li>\u4efb\u52a1\u961f\u5217&#xff08;\u5f02\u6b65\u5904\u7406&#xff09;<\/li>\n<li>\u6808\u7ed3\u6784&#xff08;\u64a4\u9500\u64cd\u4f5c&#xff09;<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u4e0d\u9002\u5408\u505a\u201c\u5206\u9875\u67e5\u8be2\u4e2d\u95f4\u6570\u636e\u201d&#xff0c;LRANGE \u504f\u79fb\u91cf\u5927\u65f6\u6027\u80fd\u5dee<\/li>\n<li>\u63a8\u8350\u4f7f\u7528 Stream \u66ff\u4ee3 List \u505a\u53ef\u9760\u6d88\u606f\u961f\u5217&#xff08;\u652f\u6301\u6d88\u8d39\u8005\u7ec4\u3001\u6301\u4e45\u5316&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h4>4. Set&#xff1a;\u65e0\u5e8f\u552f\u4e00\u96c6\u5408<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u5143\u7d20\u552f\u4e00\u3001\u65e0\u5e8f\u3001\u652f\u6301\u96c6\u5408\u8fd0\u7b97<\/li>\n<li>\u5e95\u5c42\u4e3a\u54c8\u5e0c\u8868\u6216\u6574\u6570\u96c6\u5408&#xff08;intset&#xff09;<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>SADD tags:article:1 <span class=\"token function\">java<\/span> redis spring<br \/>\nSISMEMBER tags:article:1 <span class=\"token function\">java<\/span>    <span class=\"token comment\"># \u5224\u65ad\u662f\u5426\u5305\u542b<\/span><br \/>\nSMEMBERS tags:article:1          <span class=\"token comment\"># \u83b7\u53d6\u6240\u6709\u6807\u7b7e<\/span><\/p>\n<p>SADD user:1001:friends <span class=\"token number\">2001<\/span> <span class=\"token number\">2002<\/span> <span class=\"token number\">2003<\/span><br \/>\nSADD user:2001:friends <span class=\"token number\">1001<\/span> <span class=\"token number\">3001<\/span><\/p>\n<p>SINTER user:1001:friends user:2001:friends   <span class=\"token comment\"># \u5171\u540c\u597d\u53cb<\/span><br \/>\nSUNION tags:*                                <span class=\"token comment\"># \u6240\u6709\u6807\u7b7e\u5e76\u96c6<\/span><br \/>\nSDIFF set1 set2                              <span class=\"token comment\"># \u5dee\u96c6<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u6807\u7b7e\u7cfb\u7edf&#xff08;\u6587\u7ae0\u6807\u7b7e\u3001\u7528\u6237\u5174\u8da3&#xff09;<\/li>\n<li>\u597d\u53cb\u5173\u7cfb\u3001\u5173\u6ce8\u5217\u8868<\/li>\n<li>\u53bb\u91cd&#xff08;\u5982\u5df2\u8bfb\u6587\u7ae0 ID&#xff09;<\/li>\n<li>\u6743\u9650\u63a7\u5236&#xff08;\u7528\u6237\u89d2\u8272\u96c6\u5408&#xff09;<\/li>\n<\/ul>\n<h5>\u2705 \u4f18\u52bf&#xff1a;<\/h5>\n<ul>\n<li>\u652f\u6301\u4ea4\u96c6\u3001\u5e76\u96c6\u3001\u5dee\u96c6\u7b49\u6570\u5b66\u8fd0\u7b97<\/li>\n<li>\u67e5\u8be2\u5143\u7d20\u662f\u5426\u5b58\u5728\u4e3a O(1)<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u4e0d\u4fdd\u8bc1\u987a\u5e8f&#xff0c;\u5982\u9700\u6392\u5e8f\u4f7f\u7528 Sorted Set<\/li>\n<li>\u5927\u96c6\u5408\u64cd\u4f5c&#xff08;\u5982 SUNION&#xff09;\u53ef\u80fd\u963b\u585e&#xff0c;\u5efa\u8bae\u5728\u4ece\u8282\u70b9\u6267\u884c\u6216\u5206\u6279\u5904\u7406<\/li>\n<\/ul>\n<hr \/>\n<h4>5. Sorted Set&#xff08;ZSet&#xff09;&#xff1a;\u5e26\u6743\u91cd\u7684\u6709\u5e8f\u96c6\u5408<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u6bcf\u4e2a\u5143\u7d20\u5173\u8054\u4e00\u4e2a score&#xff08;\u6d6e\u70b9\u6570&#xff09;&#xff0c;\u6309 score \u6392\u5e8f<\/li>\n<li>\u652f\u6301\u8303\u56f4\u67e5\u8be2\u3001\u6392\u540d\u8ba1\u7b97<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>ZADD leaderboard <span class=\"token number\">1000<\/span> <span class=\"token string\">&#034;Alice&#034;<\/span><br \/>\nZADD leaderboard <span class=\"token number\">950<\/span> <span class=\"token string\">&#034;Bob&#034;<\/span><br \/>\nZADD leaderboard <span class=\"token number\">1050<\/span> <span class=\"token string\">&#034;Charlie&#034;<\/span><\/p>\n<p>ZRANGE leaderboard <span class=\"token number\">0<\/span> <span class=\"token parameter variable\">-1<\/span> WITHSCORES   <span class=\"token comment\"># \u5347\u5e8f<\/span><br \/>\nZREVRANGE leaderboard <span class=\"token number\">0<\/span> <span class=\"token parameter variable\">-1<\/span> WITHSCORES <span class=\"token comment\"># \u964d\u5e8f<\/span><\/p>\n<p>ZRANK leaderboard <span class=\"token string\">&#034;Bob&#034;<\/span>               <span class=\"token comment\"># \u6392\u540d&#xff08;\u4ece0\u5f00\u59cb&#xff09;<\/span><br \/>\nZSCORE leaderboard <span class=\"token string\">&#034;Alice&#034;<\/span>            <span class=\"token comment\"># \u67e5\u770b\u5206\u6570<\/span><\/p>\n<p>ZREM leaderboard <span class=\"token string\">&#034;Bob&#034;<\/span>                <span class=\"token comment\"># \u5220\u9664\u6210\u5458<\/span><br \/>\nZCOUNT leaderboard <span class=\"token number\">900<\/span> <span class=\"token number\">1000<\/span>           <span class=\"token comment\"># \u5206\u6570\u8303\u56f4\u5185\u7684\u6210\u5458\u6570<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u6392\u884c\u699c&#xff08;\u6e38\u620f\u79ef\u5206\u3001\u9500\u552e\u699c\u3001\u70ed\u641c&#xff09;<\/li>\n<li>\u5ef6\u8fdf\u961f\u5217&#xff08;score &#061; \u6267\u884c\u65f6\u95f4\u6233&#xff09;<\/li>\n<li>\u6ed1\u52a8\u7a97\u53e3\u9650\u6d41&#xff08;score \u4e3a\u65f6\u95f4&#xff0c;\u5b9a\u671f\u6e05\u7406\u8fc7\u671f\u8bf7\u6c42&#xff09;<\/li>\n<\/ul>\n<h5>\u2705 \u9ad8\u7ea7\u6280\u5de7&#xff1a;\u5ef6\u8fdf\u961f\u5217\u5b9e\u73b0<\/h5>\n<p><span class=\"token comment\"># \u6dfb\u52a0\u5ef6\u8fdf\u4efb\u52a1&#xff08;10\u5206\u949f\u540e\u6267\u884c&#xff09;<\/span><br \/>\nZADD delay_queue <span class=\"token variable\"><span class=\"token variable\">$((<\/span>$<span class=\"token punctuation\">(<\/span>date <span class=\"token operator\">&#043;<\/span><span class=\"token operator\">%<\/span>s<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">600<\/span><span class=\"token variable\">))<\/span><\/span> <span class=\"token string\">&#034;task:email:123&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u8f6e\u8be2\u6267\u884c\u5230\u671f\u4efb\u52a1<\/span><br \/>\nZRANGEBYSCORE delay_queue <span class=\"token number\">0<\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">date<\/span> &#043;%s<span class=\"token variable\">)<\/span><\/span><br \/>\n<span class=\"token comment\"># \u6267\u884c\u540e\u5220\u9664 ZREM<\/span><\/p>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u63d2\u5165\/\u5220\u9664 O(log N)&#xff0c;\u67e5\u8be2\u6392\u540d O(log N)<\/li>\n<li>\u5927\u89c4\u6a21 ZSet \u5efa\u8bae\u8bbe\u7f6e\u8fc7\u671f\u7b56\u7565\u6216\u5206\u7247<\/li>\n<\/ul>\n<hr \/>\n<h4>6. Bitmap&#xff1a;\u4f4d\u56fe&#xff0c;\u6781\u81f4\u8282\u7701\u7a7a\u95f4<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u6bcf\u4e2a bit \u8868\u793a\u4e00\u4e2a\u72b6\u6001&#xff08;0\/1&#xff09;<\/li>\n<li>\u8282\u7701\u7a7a\u95f4&#xff0c;\u9002\u5408\u5927\u89c4\u6a21\u5e03\u5c14\u7edf\u8ba1<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p><span class=\"token comment\"># \u7528\u6237 1001 \u7b2c 5 \u5929\u7b7e\u5230<\/span><br \/>\nSETBIT user:1001:sign:2024-04 <span class=\"token number\">4<\/span> <span class=\"token number\">1<\/span><\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5\u662f\u5426\u7b7e\u5230<\/span><br \/>\nGETBIT user:1001:sign:2024-04 <span class=\"token number\">4<\/span><\/p>\n<p><span class=\"token comment\"># \u7edf\u8ba1\u672c\u6708\u7b7e\u5230\u5929\u6570<\/span><br \/>\nBITCOUNT user:1001:sign:2024-04<\/p>\n<p><span class=\"token comment\"># \u8ba1\u7b97\u8fde\u7eed\u7b7e\u5230&#xff08;\u9700 Lua \u811a\u672c&#xff09;<\/span><\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u7528\u6237\u7b7e\u5230\u7cfb\u7edf<\/li>\n<li>\u6d3b\u8dc3\u7528\u6237\u7edf\u8ba1&#xff08;\u6bcf\u65e5 UV \u5e03\u5c14\u6807\u8bb0&#xff09;<\/li>\n<li>\u7528\u6237\u884c\u4e3a\u6807\u8bb0&#xff08;\u662f\u5426\u770b\u8fc7\u67d0\u5185\u5bb9&#xff09;<\/li>\n<\/ul>\n<h5>\u2705 \u4f18\u52bf&#xff1a;<\/h5>\n<ul>\n<li>1MB \u53ef\u8868\u793a 800&#043; \u4e07\u7528\u6237\u67d0\u5929\u7684\u72b6\u6001<\/li>\n<li>\u652f\u6301\u4f4d\u8fd0\u7b97&#xff08;AND\/OR\/NOT&#xff09;\u505a\u7fa4\u4f53\u5206\u6790<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u4f4d\u7d22\u5f15\u4ece 0 \u5f00\u59cb&#xff0c;\u6ce8\u610f\u8ba1\u7b97\u504f\u79fb<\/li>\n<li>\u4e0d\u9002\u5408\u9891\u7e41\u968f\u673a\u8bbf\u95ee\u5355\u4e2a bit&#xff08;\u7f51\u7edc\u5f00\u9500&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h4>7. Geo&#xff1a;\u5730\u7406\u4f4d\u7f6e\u670d\u52a1<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u57fa\u4e8e Sorted Set \u5b9e\u73b0&#xff0c;score \u4e3a GeoHash \u7f16\u7801<\/li>\n<li>\u652f\u6301\u8ddd\u79bb\u8ba1\u7b97\u3001\u8303\u56f4\u641c\u7d22<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>GEOADD cities <span class=\"token number\">116.405285<\/span> <span class=\"token number\">39.904989<\/span> <span class=\"token string\">&#034;Beijing&#034;<\/span><br \/>\nGEOADD cities <span class=\"token number\">121.473701<\/span> <span class=\"token number\">31.230416<\/span> <span class=\"token string\">&#034;Shanghai&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u8ba1\u7b97\u8ddd\u79bb<\/span><br \/>\nGEODIST cities <span class=\"token string\">&#034;Beijing&#034;<\/span> <span class=\"token string\">&#034;Shanghai&#034;<\/span> km<\/p>\n<p><span class=\"token comment\"># \u67e5\u627e\u9644\u8fd1\u57ce\u5e02&#xff08;500km \u5185&#xff09;<\/span><br \/>\nGEORADIUS cities <span class=\"token number\">116.405285<\/span> <span class=\"token number\">39.904989<\/span> <span class=\"token number\">500<\/span> km WITHDIST<\/p>\n<p><span class=\"token comment\"># \u67e5\u627e\u9644\u8fd1\u7684\u4eba<\/span><br \/>\nGEORADIUS users:locations <span class=\"token number\">113.944<\/span> <span class=\"token number\">22.509<\/span> <span class=\"token number\">10<\/span> km<\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u9644\u8fd1\u7684\u4eba\u3001\u95e8\u5e97\u641c\u7d22<\/li>\n<li>LBS \u63a8\u8350\u3001\u6253\u8f66\u8ddd\u79bb\u8ba1\u7b97<\/li>\n<li>\u7269\u6d41\u8f68\u8ff9\u5b58\u50a8<\/li>\n<\/ul>\n<h5>\u2705 \u4f18\u52bf&#xff1a;<\/h5>\n<ul>\n<li>\u7cbe\u5ea6\u9ad8&#xff08;\u7ea6\u51e0\u7c73\u5230\u51e0\u516c\u91cc&#xff09;<\/li>\n<li>\u67e5\u8be2\u9ad8\u6548<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u7ecf\u7eac\u5ea6\u987a\u5e8f\u4e3a longitude latitude<\/li>\n<li>\u4e0d\u652f\u6301\u6d77\u62d4<\/li>\n<\/ul>\n<hr \/>\n<h4>8. HyperLogLog&#xff1a;\u6d77\u91cf\u6570\u636e\u53bb\u91cd\u8ba1\u6570<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u57fa\u6570\u4f30\u7b97\u7b97\u6cd5&#xff0c;\u8bef\u5dee &lt; 0.81%<\/li>\n<li>\u56fa\u5b9a\u5185\u5b58&#xff08;\u7ea6 12KB&#xff09;&#xff0c;\u53ef\u7edf\u8ba1\u4e0a\u4ebf\u552f\u4e00\u503c<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p>PFADD stats:uv:2024-04-05 user1 user2 user3 user1<br \/>\nPFCOUNT stats:uv:2024-04-05   <span class=\"token comment\"># \u8f93\u51fa&#xff1a;3<\/span><\/p>\n<p><span class=\"token comment\"># \u5408\u5e76\u591a\u65e5 UV<\/span><br \/>\nPFADD stats:uv:week1 stats:uv:day1 stats:uv:day2<br \/>\nPFCOUNT stats:uv:week1<\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u7f51\u7ad9\u72ec\u7acb\u8bbf\u5ba2&#xff08;UV&#xff09;\u7edf\u8ba1<\/li>\n<li>\u641c\u7d22\u8bcd\u53bb\u91cd<\/li>\n<li>\u5e7f\u544a\u66dd\u5149\u53bb\u91cd<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u662f\u4f30\u7b97\u503c&#xff0c;\u4e0d\u9002\u5408\u7cbe\u786e\u8ba1\u6570<\/li>\n<li>\u4e0d\u80fd\u83b7\u53d6\u5177\u4f53\u5143\u7d20\u96c6\u5408<\/li>\n<\/ul>\n<hr \/>\n<h4>9. Stream&#xff1a;\u5f3a\u5927\u7684\u6d88\u606f\u961f\u5217<\/h4>\n<h5>\u2705 \u7279\u6027&#xff1a;<\/h5>\n<ul>\n<li>\u6301\u4e45\u5316\u65e5\u5fd7\u7ed3\u6784<\/li>\n<li>\u652f\u6301\u6d88\u8d39\u8005\u7ec4\u3001\u6d88\u606f\u786e\u8ba4\u3001\u56de\u6eaf<\/li>\n<\/ul>\n<h5>&#x1f527; \u5e38\u7528\u547d\u4ee4&#xff1a;<\/h5>\n<p><span class=\"token comment\"># \u6dfb\u52a0\u6d88\u606f<\/span><br \/>\nXADD mystream * name Alice action login<\/p>\n<p><span class=\"token comment\"># \u8bfb\u53d6\u6d88\u606f<\/span><br \/>\nXREAD COUNT <span class=\"token number\">5<\/span> STREAMS mystream <span class=\"token number\">0<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u6d88\u8d39\u8005\u7ec4<\/span><br \/>\nXGROUP CREATE mystream mygroup $ MKSTREAM<\/p>\n<p><span class=\"token comment\"># \u6d88\u8d39&#xff08;\u5e26\u786e\u8ba4&#xff09;<\/span><br \/>\nXREADGROUP GROUP mygroup consumer1 STREAMS mystream <span class=\"token operator\">&gt;<\/span><\/p>\n<p><span class=\"token comment\"># \u786e\u8ba4\u5904\u7406\u5b8c\u6210<\/span><br \/>\nXACK mystream mygroup msg_id<\/p>\n<h5>&#x1f4a1; \u5b9e\u6218\u573a\u666f&#xff1a;<\/h5>\n<ul>\n<li>\u65e5\u5fd7\u6536\u96c6<\/li>\n<li>\u5f02\u6b65\u4efb\u52a1\u8c03\u5ea6<\/li>\n<li>\u5fae\u670d\u52a1\u95f4\u901a\u4fe1<\/li>\n<li>\u4e8b\u4ef6\u6eaf\u6e90&#xff08;Event Sourcing&#xff09;<\/li>\n<\/ul>\n<h5>\u2705 \u4f18\u52bf&#xff1a;<\/h5>\n<ul>\n<li>\u6d88\u606f\u4e0d\u4e22\u5931&#xff08;\u6301\u4e45\u5316&#xff09;<\/li>\n<li>\u652f\u6301\u591a\u6d88\u8d39\u8005\u7ec4&#xff08;\u5e7f\u64ad\u6a21\u5f0f&#xff09;<\/li>\n<li>\u53ef\u56de\u6eaf\u5386\u53f2\u6d88\u606f<\/li>\n<\/ul>\n<h5>\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/h5>\n<ul>\n<li>\u9700\u5b9a\u671f\u88c1\u526a&#xff08;XTRIM&#xff09;\u9632\u6b62\u65e0\u9650\u589e\u957f<\/li>\n<li>\u6d88\u8d39\u8005\u9700\u624b\u52a8\u786e\u8ba4&#xff08;\u907f\u514d\u6d88\u606f\u4e22\u5931&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e09\u3001\u9009\u62e9\u5408\u9002\u6570\u636e\u7c7b\u578b\u7684\u51b3\u7b56\u6811<\/h3>\n<table>\n<tr>\u4e1a\u52a1\u9700\u6c42\u63a8\u8350\u6570\u636e\u7c7b\u578b<\/tr>\n<tbody>\n<tr>\n<td>\u7f13\u5b58\u5bf9\u8c61<\/td>\n<td>String&#xff08;JSON&#xff09; \u6216 Hash<\/td>\n<\/tr>\n<tr>\n<td>\u8ba1\u6570\u5668<\/td>\n<td>String&#xff08;INCR&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5206\u5e03\u5f0f\u9501<\/td>\n<td>String&#xff08;SETNX&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6700\u65b0\u52a8\u6001<\/td>\n<td>List \u6216 Stream<\/td>\n<\/tr>\n<tr>\n<td>\u6392\u884c\u699c<\/td>\n<td>Sorted Set<\/td>\n<\/tr>\n<tr>\n<td>\u6807\u7b7e\/\u597d\u53cb<\/td>\n<td>Set<\/td>\n<\/tr>\n<tr>\n<td>\u7b7e\u5230\u7cfb\u7edf<\/td>\n<td>Bitmap<\/td>\n<\/tr>\n<tr>\n<td>\u9644\u8fd1\u7684\u4eba<\/td>\n<td>Geo<\/td>\n<\/tr>\n<tr>\n<td>UV \u7edf\u8ba1<\/td>\n<td>HyperLogLog<\/td>\n<\/tr>\n<tr>\n<td>\u6d88\u606f\u961f\u5217<\/td>\n<td>Stream&#xff08;\u751f\u4ea7\u73af\u5883&#xff09;\u6216 List&#xff08;\u7b80\u5355\u573a\u666f&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u56db\u3001\u6027\u80fd\u4f18\u5316\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<li>\n<p>\u907f\u514d\u5927 key&#xff1a;<\/p>\n<ul>\n<li>\u5355\u4e2a key &gt; 10KB \u89c6\u4e3a\u5927 key<\/li>\n<li>\u5927 Hash\/List\/Sorted Set \u5efa\u8bae\u5206\u7247&#xff08;\u5982 user:1001:orders:1&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f7f\u7528 Pipeline \u6279\u91cf\u64cd\u4f5c&#xff1a;<\/p>\n<p>pipe <span class=\"token operator\">&#061;<\/span> redis<span class=\"token punctuation\">.<\/span>pipeline<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\npipe<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">set<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;a&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><br \/>\npipe<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">set<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;b&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><br \/>\npipe<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<\/li>\n<li>\n<p>\u5408\u7406\u8bbe\u7f6e TTL&#xff1a;\u9632\u6b62\u5185\u5b58\u6cc4\u6f0f<\/p>\n<\/li>\n<li>\n<p>\u76d1\u63a7\u5927 key \u548c\u70ed key&#xff1a;<\/p>\n<ul>\n<li>\u4f7f\u7528 redis-cli &#8211;bigkeys<\/li>\n<li>\u76d1\u63a7 info memory \u548c\u6162\u67e5\u8be2\u65e5\u5fd7<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f7f\u7528 Lua \u811a\u672c\u4fdd\u8bc1\u539f\u5b50\u6027&#xff1a;<\/p>\n<ul>\n<li>\u590d\u6742\u903b\u8f91\u5728\u670d\u52a1\u7aef\u6267\u884c&#xff0c;\u51cf\u5c11\u7f51\u7edc\u5f80\u8fd4<\/li>\n<\/ul>\n<\/li>\n<hr \/>\n<h3>\u4e94\u3001\u603b\u7ed3&#xff1a;Redis \u6570\u636e\u7c7b\u578b\u7684\u201c\u80fd\u529b\u5730\u56fe\u201d<\/h3>\n<table>\n<tr>\u7c7b\u578b\u9002\u7528\u573a\u666f\u662f\u5426\u6709\u5e8f\u662f\u5426\u552f\u4e00\u662f\u5426\u652f\u6301\u8303\u56f4\u67e5\u8be2<\/tr>\n<tbody>\n<tr>\n<td>String<\/td>\n<td>\u7f13\u5b58\u3001\u8ba1\u6570<\/td>\n<td>\u5426<\/td>\n<td>\u5426<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>Hash<\/td>\n<td>\u5bf9\u8c61\u5b58\u50a8<\/td>\n<td>\u5426<\/td>\n<td>field \u552f\u4e00<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>List<\/td>\n<td>\u961f\u5217\u3001\u6808<\/td>\n<td>\u662f<\/td>\n<td>\u5426<\/td>\n<td>\u652f\u6301\u7d22\u5f15\u8bbf\u95ee<\/td>\n<\/tr>\n<tr>\n<td>Set<\/td>\n<td>\u53bb\u91cd\u3001\u96c6\u5408\u8fd0\u7b97<\/td>\n<td>\u5426<\/td>\n<td>\u662f<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>Sorted Set<\/td>\n<td>\u6392\u884c\u699c\u3001\u5ef6\u8fdf\u961f\u5217<\/td>\n<td>\u662f&#xff08;score&#xff09;<\/td>\n<td>\u662f<\/td>\n<td>\u2705 \u652f\u6301\u8303\u56f4<\/td>\n<\/tr>\n<tr>\n<td>Bitmap<\/td>\n<td>\u5e03\u5c14\u7edf\u8ba1<\/td>\n<td>\u662f&#xff08;bit \u4f4d&#xff09;<\/td>\n<td>\u5426<\/td>\n<td>\u2705 \u4f4d\u8fd0\u7b97<\/td>\n<\/tr>\n<tr>\n<td>Geo<\/td>\n<td>\u5730\u7406\u4f4d\u7f6e<\/td>\n<td>\u662f&#xff08;GeoHash&#xff09;<\/td>\n<td>\u662f<\/td>\n<td>\u2705 \u8303\u56f4\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>HyperLogLog<\/td>\n<td>\u53bb\u91cd\u8ba1\u6570<\/td>\n<td>\u5426<\/td>\n<td>\u81ea\u52a8\u53bb\u91cd<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>Stream<\/td>\n<td>\u6d88\u606f\u961f\u5217<\/td>\n<td>\u662f&#xff08;ID&#xff09;<\/td>\n<td>\u662f<\/td>\n<td>\u2705 \u6309 ID \u8303\u56f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<p>\u2705 \u7ed3\u8bed&#xff1a;<br \/>\nRedis \u7684\u201c\u5927\u6570\u636e\u7c7b\u578b\u201d\u662f\u5176\u8d85\u8d8a\u4f20\u7edf\u7f13\u5b58\u7684\u6838\u5fc3\u7ade\u4e89\u529b\u3002\u638c\u63e1\u6bcf\u79cd\u7c7b\u578b\u7684\u7279\u70b9\u4e0e\u9002\u7528\u573a\u666f&#xff0c;\u80fd\u8ba9\u4f60\u5728\u67b6\u6784\u8bbe\u8ba1\u4e2d\u6e38\u5203\u6709\u4f59&#xff0c;\u5b9e\u73b0\u9ad8\u6027\u80fd\u3001\u4f4e\u5ef6\u8fdf\u3001\u9ad8\u53ef\u7528\u7684\u7cfb\u7edf\u3002<\/p>\n<p>\u8bb0\u4f4f&#xff1a;\u7528\u5bf9\u6570\u636e\u7ed3\u6784&#xff0c;\u6bd4\u4f18\u5316\u4ee3\u7801\u66f4\u91cd\u8981\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb256\u6b21\u3002Redis \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u9700\u6c42\uff0c\u5305\u62ec String\uff08\u7f13\u5b58\/\u8ba1\u6570\u5668\uff09\u3001Hash\uff08\u5bf9\u8c61\u5b58\u50a8\uff09\u3001List\uff08\u961f\u5217\/\u6808\uff09\u3001Set\uff08\u53bb\u91cd\u96c6\u5408\uff09\u3001Sorted Set\uff08\u6392\u884c\u699c\uff09\u3001Bitmap\uff08\u7b7e\u5230\u7edf\u8ba1\uff09\u3001Geo\uff08\u5730\u7406\u4f4d\u7f6e\uff09\u548c HyperLogLog\uff08\u57fa\u6570\u7edf\u8ba1\uff09\u3002\u6bcf\u79cd\u7c7b\u578b\u9488\u5bf9\u7279\u5b9a\u7528\u9014\u4f18\u5316\uff0c\u5982 String \u9002\u5408\u70ed\u70b9\u7f13\u5b58\uff0cHash \u8282\u7701\u5185\u5b58\u5b58\u50a8\u5bf9\u8c61\uff0cSorted Set \u5b9e\u73b0\u6392\u884c\u699c\uff0cBitmap \u9ad8\u6548\u7edf\u8ba1\u5e03\u5c14\u72b6\u6001\u3002Redis \u6570\u636e\u7ed3\u6784\u652f\u6301\u539f\u5b50\u64cd\u4f5c\u3001\u8fc7\u671f\u65f6\u95f4\u548c\u9ad8\u6027\u80fd\u8bfb\u5199\uff0c\u4f46\u5728\u4f7f\u7528\u65f6\u9700\u6ce8\u610f\u6570\u636e\u89c4\u6a21\u63a7\u5236\uff0c\u907f\u514d\u5927<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2563,105,100,398],"topic":[],"class_list":["post-53094","post","type-post","status-publish","format-standard","hentry","category-server","tag-nosql","tag-redis","tag-100","tag-398"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/53094.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb256\u6b21\u3002Redis \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u9700\u6c42\uff0c\u5305\u62ec String\uff08\u7f13\u5b58\/\u8ba1\u6570\u5668\uff09\u3001Hash\uff08\u5bf9\u8c61\u5b58\u50a8\uff09\u3001List\uff08\u961f\u5217\/\u6808\uff09\u3001Set\uff08\u53bb\u91cd\u96c6\u5408\uff09\u3001Sorted Set\uff08\u6392\u884c\u699c\uff09\u3001Bitmap\uff08\u7b7e\u5230\u7edf\u8ba1\uff09\u3001Geo\uff08\u5730\u7406\u4f4d\u7f6e\uff09\u548c HyperLogLog\uff08\u57fa\u6570\u7edf\u8ba1\uff09\u3002\u6bcf\u79cd\u7c7b\u578b\u9488\u5bf9\u7279\u5b9a\u7528\u9014\u4f18\u5316\uff0c\u5982 String \u9002\u5408\u70ed\u70b9\u7f13\u5b58\uff0cHash \u8282\u7701\u5185\u5b58\u5b58\u50a8\u5bf9\u8c61\uff0cSorted Set \u5b9e\u73b0\u6392\u884c\u699c\uff0cBitmap \u9ad8\u6548\u7edf\u8ba1\u5e03\u5c14\u72b6\u6001\u3002Redis \u6570\u636e\u7ed3\u6784\u652f\u6301\u539f\u5b50\u64cd\u4f5c\u3001\u8fc7\u671f\u65f6\u95f4\u548c\u9ad8\u6027\u80fd\u8bfb\u5199\uff0c\u4f46\u5728\u4f7f\u7528\u65f6\u9700\u6ce8\u610f\u6570\u636e\u89c4\u6a21\u63a7\u5236\uff0c\u907f\u514d\u5927\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/53094.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-11T16:19:51+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53094.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/53094.html\",\"name\":\"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-11T16:19:51+00:00\",\"dateModified\":\"2025-08-11T16:19:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/53094.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/53094.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53094.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/53094.html","og_locale":"zh_CN","og_type":"article","og_title":"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb256\u6b21\u3002Redis \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784\u4ee5\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u9700\u6c42\uff0c\u5305\u62ec String\uff08\u7f13\u5b58\/\u8ba1\u6570\u5668\uff09\u3001Hash\uff08\u5bf9\u8c61\u5b58\u50a8\uff09\u3001List\uff08\u961f\u5217\/\u6808\uff09\u3001Set\uff08\u53bb\u91cd\u96c6\u5408\uff09\u3001Sorted Set\uff08\u6392\u884c\u699c\uff09\u3001Bitmap\uff08\u7b7e\u5230\u7edf\u8ba1\uff09\u3001Geo\uff08\u5730\u7406\u4f4d\u7f6e\uff09\u548c HyperLogLog\uff08\u57fa\u6570\u7edf\u8ba1\uff09\u3002\u6bcf\u79cd\u7c7b\u578b\u9488\u5bf9\u7279\u5b9a\u7528\u9014\u4f18\u5316\uff0c\u5982 String \u9002\u5408\u70ed\u70b9\u7f13\u5b58\uff0cHash \u8282\u7701\u5185\u5b58\u5b58\u50a8\u5bf9\u8c61\uff0cSorted Set \u5b9e\u73b0\u6392\u884c\u699c\uff0cBitmap \u9ad8\u6548\u7edf\u8ba1\u5e03\u5c14\u72b6\u6001\u3002Redis \u6570\u636e\u7ed3\u6784\u652f\u6301\u539f\u5b50\u64cd\u4f5c\u3001\u8fc7\u671f\u65f6\u95f4\u548c\u9ad8\u6027\u80fd\u8bfb\u5199\uff0c\u4f46\u5728\u4f7f\u7528\u65f6\u9700\u6ce8\u610f\u6570\u636e\u89c4\u6a21\u63a7\u5236\uff0c\u907f\u514d\u5927","og_url":"https:\/\/www.wsisp.com\/helps\/53094.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-11T16:19:51+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/53094.html","url":"https:\/\/www.wsisp.com\/helps\/53094.html","name":"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-11T16:19:51+00:00","dateModified":"2025-08-11T16:19:51+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/53094.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/53094.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/53094.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Redis \u5927\u6570\u636e\u7c7b\u578b\u5b9e\u6218\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/53094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=53094"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/53094\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=53094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=53094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=53094"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=53094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}