
{"id":1238,"date":"2021-01-30T16:33:02","date_gmt":"2021-01-30T08:33:02","guid":{"rendered":"https:\/\/www.changxuan.top\/?p=1238"},"modified":"2021-04-15T17:05:56","modified_gmt":"2021-04-15T09:05:56","slug":"%e3%80%90redis-%e5%88%86%e5%b8%83%e5%bc%8f%e9%94%81%e3%80%91%ef%bc%882%ef%bc%89%e5%a5%bd%e7%94%a8%e4%b8%80%e7%82%b9%e7%9a%84%e9%94%81","status":"publish","type":"post","link":"https:\/\/www.changxuan.top\/?p=1238","title":{"rendered":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d"},"content":{"rendered":"\n<p>\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\uff08<a href=\"https:\/\/www.changxuan.top\/?p=1230\" target=\"_blank\" rel=\"noopener noreferrer\">\u4e00\u628a\u7b80\u5355\u7684\u201c\u9501\u201d<\/a>\uff09\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u4e86\u76ee\u524d\u9501\u5b58\u5728\u4e24\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u67d0\u4e2a\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u9501\u53ef\u4ee5\u88ab\u5176\u5b83\u7ebf\u7a0b\u968f\u610f\u91ca\u653e\u6389<\/strong><\/li><li><strong>\u76ee\u524d\u9501\u8fd8\u4e0d\u652f\u6301\u53ef\u914d\u7f6e\u7684\u963b\u585e\/\u975e\u963b\u585e\u9501<\/strong><\/li><\/ul>\n\n\n\n<p><em>\u6ce8\uff1a\u5f53\u7136\u4e0d\u4ec5\u4ec5\u5b58\u5728\u8fd9\u4e24\u4e2a\u95ee\u9898<\/em><\/p>\n\n\n\n<p><strong>\u9996\u5148\uff0c\u6211\u4eec\u6765\u770b\u7b2c\u4e00\u4e2a\u95ee\u9898<\/strong>\u3002\u4e4b\u6240\u4ee5\u5b58\u5728\u8fd9\u79cd\u95ee\u9898\uff0c\u662f\u56e0\u4e3a\u5728\u91ca\u653e\u9501\u7684\u65f6\u5019\u53ea\u8981\u77e5\u9053\u8fd9\u628a\u9501\u7684\u540d\u79f0(key)\u5c31\u80fd\u91ca\u653e\u6210\u529f\u4e86\u3002\u5c31\u597d\u6bd4\u4f60\u8fdb\u5367\u5ba4\u540e\uff0c\u5728\u5367\u5ba4\u95e8\u4e0a\u52a0\u4e86\u4e00\u628a\u201c\u5367\u5ba4\u9501\u201d(key)\uff0c\u7136\u540e\u6709\u5176\u4ed6\u4eba\u60f3\u8fdb\u7684\u65f6\u5019\u5c31\u8bf4\u91ca\u653e&#8221;\u5367\u5ba4\u9501&#8221;\uff0c\u7136\u540e\u95e8\u5c31\u5f00\u4e86\u3002\u6240\u4ee5\uff0c\u8fd9\u628a\u9501\u4e5f\u592a\u4e0d\u5b89\u5168\u4e86\u3002\u60f3\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u9501\u4e0a\u518d\u52a0\u70b9\u4e1c\u897f\u5373\u6807\u8bc6\uff0c\u6765\u533a\u5206\u5230\u5e95\u662f\u8c01\u7684\u52a0\u7684\u9501\u3002\u8fd9\u6837\u518d\u53bb\u91ca\u653e\u9501\u7684\u65f6\u5019\uff0c\u62ff\u7740key\u548c\u6807\u8bc6\u6765\u5224\u65ad\u80fd\u4e0d\u80fd\u91ca\u653e\u9501\u3002<\/p>\n\n\n\n<p>\u5728\u7b2c\u4e00\u7248\u7684\u9501\u4e2d\uff0c\u52a0\u9501\u7684\u6838\u5fc3\u4ee3\u7801\u662f\u8fd9\u4e00\u884c\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(key, \"LOCK\"));<\/pre>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5176\u4e2d <code>value<\/code> \u7684\u4f4d\u7f6e\uff0c\u6211\u4eec\u53ea\u653e\u4e86\u4e00\u4e2a\u56fa\u5b9a\u503c LOCK \uff0c\u6709\u4e9b\u6d6a\u8d39\u7a7a\u95f4\u3002\u6240\u4ee5\uff0c\u8fd9\u4e2a\u5730\u65b9\u53ef\u4ee5\u7528\u6765\u5b58\u50a8\u4e00\u4e2a\u552f\u4e00\u7684\u6807\u8bc6\u3002\u5728\u91ca\u653e\u9501\u7684\u65f6\u5019\uff0c\u7528\u6765\u5224\u65ad\u80fd\u5426\u91ca\u653e\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\uff0c<strong>\u52a0\u9501\uff08\u83b7\u53d6\u9501\uff09<\/strong>\u7684\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u6539\u5199\u6210\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n  * \u52a0\u9501\/\u83b7\u53d6\u9501\n  * @param key \u9501\u540d\u79f0\n  * @param identity \u6807\u8bc6\n  * @return boolean \u662f\u5426\u52a0\u9501\u6210\u529f\n  *\/\npublic boolean lock(String key, String identity) {\n    boolean lock;\n    try {\n        lock = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(key, identity));\n    } catch (Exception e) {\n        log.error(\"\u83b7\u53d6\u9501\uff1a{}\uff0c\u51fa\u73b0\u9519\u8bef{}\", key, e);\n        return false;\n    }\n    return lock;\n}<\/pre>\n\n\n\n<p> \u540c\u65f6\uff0c\u91ca\u653e\u9501\u7684\u65b9\u6cd5\uff0c\u6539\u6210\u8fd9\u4e2a\u6837\u5b50\uff1a <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n  * \u91ca\u653e\u9501\n  * @param key \u9501\u540d\u79f0\n  * @param identity \u6807\u8bc6\n  *\/\npublic void unlock(String key, String identity) {\n    try {\n        Object obj = redisTemplate.opsForValue().get(key);\n        String value = obj != null ? obj.toString():null;\n        if (value != null){\n            if (value.equals(identity)) {\n                redisTemplate.delete(key);\n            }\n        }\n    }catch (Exception e) {\n        log.error(\"\u91ca\u653e\u9501\u64cd\u4f5c\u5931\u8d25,key:\" + key + \"\u5931\u8d25\u539f\u56e0:\",e);\n    }\n}<\/pre>\n\n\n\n<p>\u901a\u8fc7\u4e0a\u9762\u7684\u6539\u9020\uff0c\u6211\u4eec\u53ea\u8981\u5728\u83b7\u53d6\u9501\u65f6\u540c\u65f6\u52a0\u4e0a\u4e00\u4e2a\u552f\u4e00\u6807\u8bc6\u5c31\u80fd\u4fdd\u8bc1\u6211\u4eec\u6240\u6301\u6709\u7684\u9501\u4e0d\u4f1a\u88ab\u5176\u5b83\u7ebf\u7a0b\u6076\u610f\u91ca\u653e\u6389\u4e86\u3002\u751f\u6210\u552f\u4e00\u6807\u8bc6\u7684\u65b9\u5f0f\u6709\u5f88\u591a\u79cd\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u6240\u4f9d\u8d56\u7684\u5de5\u5177\u5e93\u8fdb\u884c\u9009\u62e9\u3002\u4f8b\u5982\uff0c\u6211\u5728\u9879\u76ee\u4e2d\u5e38\u7528\u7684\u5c31\u662f <code>hutool<\/code> \u5de5\u5177\u5305\u4e2d\u7684 <code>StrUtil.uuid()<\/code> \u65b9\u6cd5\u3002<\/p>\n\n\n\n<p><strong>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8981\u89e3\u51b3\u7b2c\u4e8c\u4e2a\u95ee\u9898\u3002<\/strong>\u6211\u4e0d\u60f3\u5982\u679c\u83b7\u53d6\u4e0d\u5230\u9501\uff0c\u76f4\u63a5\u5c31\u8fd4\u56de\u4e86 <code>false<\/code>\uff0c<strong>\u505a\u4eba\u8981\u6709\u6052\u5fc3\u3001\u6709\u6bc5\u529b\uff0c\u505a\u9501\u4e5f\u662f\u3002<\/strong>\u6240\u4ee5\uff0c\u5f53\u6ca1\u6709\u83b7\u53d6\u5230\u9501\u7684\u65f6\u5019\uff0c\u9700\u8981\u8ba9\u5b83\u4e00\u76f4\u5c1d\u8bd5\u83b7\u53d6\u9501\uff0c\u662f\u4e0d\u662f\u6709\u70b9 <code>\u81ea\u65cb\u9501<\/code> \u90a3\u4e2a\u610f\u601d\u4e86\u3002\u5f53\u7136\uff0c\u4e5f\u4e0d\u80fd\u65e0\u4e0a\u9650\u7684\u5c1d\u8bd5\u83b7\u53d6\uff0c<strong>\u505a\u4eba\u8981\u628a\u63e1\u597d\u4e00\u4e2a\u5ea6\uff0c\u505a\u9501\u4e5f\u662f<\/strong>\u3002\u8fd9\u91cc\u6709\u4e24\u4e2a\u9009\u62e9\uff0c\u4e00\u3001\u53ef\u4ee5\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff0c\u4e8c\u3001\u53ef\u4ee5\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u3002\u5728\u4e00\u822c\u7684\u9879\u76ee\u4e2d\uff0c\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u662f\u6bd4\u8f83\u5b9e\u7528\u7684\u9009\u62e9\u3002\u800c\u4e14\uff0c\u5982\u679c\u5b9e\u73b0\u4e86\u4e00\u628a\u80fd\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u7684\u9501\uff0c\u90a3\u4e48\u4e00\u5b9a\u4e5f\u80fd\u5b9e\u73b0\u8bbe\u7f6e\u6700\u5927\u5c1d\u8bd5\u6b21\u6570\u7684\u9501\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u8fd9\u91cc\u9009\u62e9\u5728 <code>boolean lock(String key, String identity)<\/code> \u57fa\u7840\u4e0a\u5b9e\u73b0\u4e00\u628a\u80fd\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u7684\u9501\u3002\u5f53\u7136\uff0c\u83b7\u53d6\u9501\u7684\u65b9\u6cd5\u4f1a\u589e\u52a0\u4e00\u4e2a\u53c2\u6570[\u8d85\u65f6\u65f6\u957f] <code>sec<\/code> \u3002\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n  * \u963b\u585e\u9501\n  * @param key \u9501\u540d\u79f0\n  * @param identity \u6807\u8bc6\n  * @param sec \u8d85\u65f6\u65f6\u957f\uff08\u79d2\uff09\n  * @return boolean \u662f\u5426\u6210\u529f\u83b7\u53d6\u9501\n  *\/\npublic boolean lockb(String key, String identity, int sec) {\n    try {\n        int count = 0;\n        while (!lock(key, identity)) {\n            Thread.sleep(100);\n            count++;\n            if (count &amp;gt; sec * 1000L \/ 100) {\n                if (sec != 0) {\n                    log.warn(\"\u7ebf\u7a0b\uff1a{}\u83b7\u53d6\u9501{}\u8d85\u65f6\", Thread.currentThread().getName(), key);\n                }\n                return false;\n            }\n        }\n        return true;\n    } catch (Exception e) {\n        log.error(\"\u83b7\u53d6\u9501\uff1a{}\uff0c\u51fa\u73b0\u9519\u8bef{}\", key, e);\n        return false;\n    }\n}<\/pre>\n\n\n\n<p>\u8fd8\u8bb0\u5f97\u6211\u4eec\u5728\u7b2c\u4e00\u7bc7\u6587\u7ae0\u4e2d\u7684\u6d4b\u8bd5\u7528\u4f8b\u5427\uff0c\u6d4b\u8bd5\u7528\u4f8b\u4e2d <code>count<\/code> \u7684\u8f93\u51fa\u7ed3\u679c\u662f 1000\uff0c \u8868\u660e\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u5bf9 <code>count<\/code> \u6267\u884c\u4e861000\u6b21\u81ea\u589e\u64cd\u4f5c\uff0c\u5176\u4f59\u4e5d\u4e2a\u7ebf\u7a0b\u6ca1\u6709\u83b7\u53d6\u5230\u9501\u540e\u5c31\u76f4\u63a5\u653e\u5f03\u4e86\u3002\u73b0\u5728\u6211\u4eec\uff0c\u7a0d\u5fae\u4fee\u6539\u4e00\u4e0b\u6d4b\u8bd5\u4ee3\u7801\u4f7f\u7528 <code>boolean lockb(String key, String identity, int sec)<\/code> \u65b9\u6cd5\u8ba9\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u673a\u4f1a\u6267\u884c\u81ea\u589e\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p>\u6d4b\u8bd5\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p><strong>@WorkService.java<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public static int count = 0;\n\nprivate static final int TIME = 1000;\n\npublic void work() {\n    String key = \"TEST_KEY\";\n    String identity = StrUtil.uuid();\n    \/\/ \u6700\u5927\u8d85\u65f6\u65f6\u95f4\n    int timeout = 20;\n    \/\/ \u65b0\u83b7\u53d6\u9501\u65b9\u6cd5\n    if (redisUtil.lockb(key, identity, timeout)) {\n        try {\n            increment();\n        }catch (Exception e) {\n            log.error(\"\u53d1\u751f\u9519\u8bef\",e);\n        }finally {\n            \/\/ \u65b0\u91ca\u653e\u9501\u65b9\u6cd5\n            redisUtil.unlock(key, identity);\n        }\n    } else {\n        log.info(\"\u7ebf\u7a0b\uff1a{},\u672a\u83b7\u53d6\u5230\u9501\", Thread.currentThread().getName());\n    }\n}\n\nprivate void increment() {\n    for (int i = 0; i &amp;lt; TIME; i++) {\n        WorkService.count++;\n    }\n}<\/pre>\n\n\n\n<p><strong>\u6d4b\u8bd5\uff08\u63a7\u5236\u53f0\u8f93\u51fa\uff09<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">count = 10000<\/pre>\n\n\n\n<p>\u5982\u9884\u671f\u4e00\u6837\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6267\u884c\u4e86 1000 \u6b21\u81ea\u589e\u64cd\u4f5c\uff0c10\u4e2a\u7ebf\u7a0b\u6267\u884c\u5b8c\u6bd5\u540e <code>count<\/code> \u7684\u503c\u6210\u4e3a\u4e86 10000\u3002<\/p>\n\n\n\n<p>\u597d\u4e86\uff0c\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u6210\u529f\u4e86\u89e3\u51b3\u4e86\u4e4b\u524d\u63d0\u5230\u7684\u4e24\u4e2a\u95ee\u9898\u3002\u90a3\u4e48\u518d\u597d\u597d\u60f3\u60f3\uff0c\u662f\u5426\u8fd8\u5b58\u5728\u5176\u5b83\u95ee\u9898\u6216\u8005\u9700\u6c42\u5462\uff1f<\/p>\n\n\n\n<p><strong>\u5f80\u5f80\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f1a\u51fa\u73b0\u5404\u79cd\u610f\u60f3\u4e0d\u5230\u7684\u95ee\u9898<\/strong>\uff0c\u5047\u5982\u6211\u4eec\u7684\u4ee3\u7801\u5728\u6267\u884c  <code>increment()<\/code> \u65b9\u6cd5\u65f6\uff0c\u5f53\u524d\u7684\u8fd9\u53f0\u673a\u5668\u7a81\u7136\u65ad\u7535\u4e86\uff01\u90a3\u4e48\u8fd9\u628a\u9501\uff0c\u4e5f\u5c06\u4f1a\u662f\u4e00\u76f4\u88ab\u6301\u6709\u7684\u72b6\u6001\u4e86\u3002\u4e0d\u51fa\u610f\u5916\u7684\u8bdd\u5176\u5b83\u7ebf\u7a0b\u518d\u4e5f\u83b7\u53d6\u4e0d\u5230\u9501\u4e86\uff0c\u4e0d\u51fa\u610f\u5916\u7684\u8bdd\u7a0b\u5e8f\u5458\u5c0f\u54e5\u53c8\u8981\u5199\u68c0\u8ba8\u4e86&#8230; &#8230; <\/p>\n\n\n\n<p>\u53e6\u5916\uff0c\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7531\u4e8e\u5b50\u7cfb\u7edf\u9700\u8981\u652f\u6301\u6c34\u5e73\u6269\u5c55\uff0c\u5927\u90fd\u662f\u4ee5\u96c6\u7fa4\u7684\u5f62\u5f0f\u8fdb\u884c\u90e8\u7f72\u7684\u3002\u6bcf\u4e2a\u8282\u70b9\u4e2d\u4f1a\u5b58\u5728\u540c\u6837\u7684\u5b9a\u65f6\u4efb\u52a1\uff08\u4f8b\u5982\u6bcf\u5929\u6267\u884c\u4e00\u6b21\uff09\uff0c\u5f53\u7cfb\u7edf\u90e8\u7f72\u6210\u529f\u540e\u6211\u5e76\u4e0d\u60f3\u96c6\u7fa4\u7684\u6bcf\u4e2a\u8282\u70b9\u90fd\u53bb\u8dd1\u4e00\u904d\u5b9a\u65f6\u4efb\u52a1\u3002\u53ef\u80fd\u4f60\u4f1a\u8bf4\uff0c\u4f60\u4f7f\u7528\u975e\u963b\u585e\u9501\u4e0d\u5c31\u884c\u4e86\u3002\u8fd9\u6837\u5230\u5f00\u59cb\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u65f6\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u80fd\u591f\u83b7\u53d6\u5230\u9501\uff0c\u5176\u5b83\u6ca1\u83b7\u53d6\u5230\u9501\u7684\u7ebf\u7a0b\u5c31\u4e0d\u4f1a\u6267\u884c\u6b64\u6b21\u5b9a\u65f6\u4efb\u52a1\u7684\u4e1a\u52a1\u4ee3\u7801\u4e86\u3002 \u770b\u6765\u6211\u9700\u8981\u518d\u6b21\u91cd\u7533\u4e00\u904d\u8fd9\u53e5\u8bdd\u4e86\u201c<strong>\u5f80\u5f80\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f1a\u51fa\u73b0\u5404\u79cd\u610f\u60f3\u4e0d\u5230\u7684\u95ee\u9898<\/strong>\u201d\uff0c\u4e07\u4e00\u96c6\u7fa4\u6709\u4e2a\u8282\u70b9\u7684\u65f6\u95f4\u4e0d\u51c6\u786e\uff0c\u4e0e\u5176\u5b83\u8282\u70b9\u7684\u65f6\u95f4\u5dee\u521a\u597d\u5927\u4e8e\u6267\u884c\u4e00\u6b21\u5b9a\u65f6\u4efb\u52a1\u6240\u6d88\u8017\u7684\u65f6\u95f4\u5462\uff1f\u5982\u679c\u4ecd\u7136\u4f7f\u7528\u4e4b\u524d\u7684\u975e\u963b\u585e\u9501\uff0c\u662f\u4e0d\u662f\u5728\u5f88\u77ed\u7684\u65f6\u95f4\u5185\u5c31\u6267\u884c\u4e86\u4e24\u6b21\u5b9a\u65f6\u4efb\u52a1\uff0c\u8fd9\u4e0e\u4f60\u7684\u9884\u671f\u4e0d\u7b26\u4e86\u3002\u53ef\u80fd\u4f60\u4f1a\u8bf4\uff0c\u6267\u884c\u4e24\u6b21\u5c31\u6267\u884c\u4e24\u6b21\u5427\uff01\u8fd9\u6837\u7684\u8bdd\uff0c\u4f60\u53ef\u4e0d\u662f\u4e00\u4e2a\u201c\u597d\u201d\u7a0b\u5e8f\u5458\u3002<strong>\u505a\u4e8b\u60c5\u8981\u4e25\u8c28\uff0c\u8981\u8ba4\u771f\uff0c\u4e00\u4e1d\u4e0d\u82df\uff0c\u5199\u4ee3\u7801\u4e5f\u662f\uff0c\u8fd9\u6837\u624d\u80fd\u5c3d\u91cf\u907f\u514d\u7cfb\u7edf\u5c11\u51fa\u4e8b\u6545\u3002<\/strong><\/p>\n\n\n\n<p><strong>Redis \u5206\u5e03\u5f0f\u9501\u7cfb\u5217\u6587\u7ae0<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.changxuan.top\/?p=1230\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff081\uff09\u4e00\u628a\u7b80\u5355\u7684\u201c\u9501\u201d<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.changxuan.top\/?p=1238\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/www.changxuan.top\/?p=1243\" target=\"_blank\">\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff083\uff09\u5b8c\u5584\u8fd9\u628a\u201c\u9501\u201d<\/a><\/p>\n\n\n\n<p><strong>\u6700\u65b0\u6587\u7ae0<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/www.changxuan.top\/?p=1865\">\u3010\u7a0b\u5e8f\u4eba\u751f\u3011\u5de5\u4f5c\u516d\u5e74<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/www.changxuan.top\/?p=1854\">\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784\u4e2d\u7684 7 \u4e2a\u5e38\u7528\u601d\u60f3<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/www.changxuan.top\/?p=1808\">k3s\u3001ctr\u3001contained\u3001images \u95ee\u9898\u5c0f\u8bb0<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/www.changxuan.top\/?p=1798\">\u3010\u7a0b\u5e8f\u4eba\u751f\u3011\u5de5\u4f5c\u4e94\u5e74<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/www.changxuan.top\/?p=1609\">\u8dd1\u6b65<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\uff08\u4e00\u628a\u7b80\u5355\u7684\u201c\u9501\u201d\uff09\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u4e86\u76ee\u524d\u9501\u5b58\u5728\u4e24\u4e2a\u95ee\u9898\uff1a \u67d0\u4e2a\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u9501\u53ef\u4ee5\u88ab\u5176\u5b83\u7ebf\u7a0b\u968f\u610f\u91ca\u653e\u6389 &hellip; <a href=\"https:\/\/www.changxuan.top\/?p=1238\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[88,97],"class_list":["post-1238","post","type-post","status-publish","format-standard","hentry","category-tech","tag-redis","tag-97"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69<\/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.changxuan.top\/?p=1238\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69\" \/>\n<meta property=\"og:description\" content=\"\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\uff08\u4e00\u628a\u7b80\u5355\u7684\u201c\u9501\u201d\uff09\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u4e86\u76ee\u524d\u9501\u5b58\u5728\u4e24\u4e2a\u95ee\u9898\uff1a \u67d0\u4e2a\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u9501\u53ef\u4ee5\u88ab\u5176\u5b83\u7ebf\u7a0b\u968f\u610f\u91ca\u653e\u6389 &hellip; \u7ee7\u7eed\u9605\u8bfb\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.changxuan.top\/?p=1238\" \/>\n<meta property=\"og:site_name\" content=\"\u5e38\u8f69\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-30T08:33:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-15T09:05:56+00:00\" \/>\n<meta name=\"author\" content=\"\u5e38\u8f69\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5e38\u8f69\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238\"},\"author\":{\"name\":\"\u5e38\u8f69\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#\\\/schema\\\/person\\\/08c8f0af44536928094dc1b4f88da3bd\"},\"headline\":\"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d\",\"datePublished\":\"2021-01-30T08:33:02+00:00\",\"dateModified\":\"2021-04-15T09:05:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238\"},\"wordCount\":11,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#\\\/schema\\\/person\\\/08c8f0af44536928094dc1b4f88da3bd\"},\"keywords\":[\"Redis\",\"\u5206\u5e03\u5f0f\u9501\"],\"articleSection\":[\"\u6280\u672f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.changxuan.top\\\/?p=1238#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238\",\"url\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238\",\"name\":\"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#website\"},\"datePublished\":\"2021-01-30T08:33:02+00:00\",\"dateModified\":\"2021-04-15T09:05:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.changxuan.top\\\/?p=1238\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/?p=1238#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/www.changxuan.top\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#website\",\"url\":\"https:\\\/\\\/www.changxuan.top\\\/\",\"name\":\"\u5e38\u8f69\",\"description\":\"\u95fb\u9053\u6709\u5148\u540e\uff0c\u672f\u4e1a\u6709\u4e13\u653b-\u4e00\u4e8c\u4e09\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#\\\/schema\\\/person\\\/08c8f0af44536928094dc1b4f88da3bd\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.changxuan.top\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/#\\\/schema\\\/person\\\/08c8f0af44536928094dc1b4f88da3bd\",\"name\":\"\u5e38\u8f69\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_008520200606-095631.jpg\",\"url\":\"https:\\\/\\\/www.changxuan.top\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_008520200606-095631.jpg\",\"contentUrl\":\"https:\\\/\\\/www.changxuan.top\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_008520200606-095631.jpg\",\"width\":960,\"height\":960,\"caption\":\"\u5e38\u8f69\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.changxuan.top\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_008520200606-095631.jpg\"},\"description\":\"\u603b\u8981\u505a\u70b9\u4ec0\u4e48\u5427\uff01\",\"sameAs\":[\"https:\\\/\\\/www.changxuan.top\"],\"url\":\"https:\\\/\\\/www.changxuan.top\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69","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.changxuan.top\/?p=1238","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69","og_description":"\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\uff08\u4e00\u628a\u7b80\u5355\u7684\u201c\u9501\u201d\uff09\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u4e86\u76ee\u524d\u9501\u5b58\u5728\u4e24\u4e2a\u95ee\u9898\uff1a \u67d0\u4e2a\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u9501\u53ef\u4ee5\u88ab\u5176\u5b83\u7ebf\u7a0b\u968f\u610f\u91ca\u653e\u6389 &hellip; \u7ee7\u7eed\u9605\u8bfb\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d","og_url":"https:\/\/www.changxuan.top\/?p=1238","og_site_name":"\u5e38\u8f69","article_published_time":"2021-01-30T08:33:02+00:00","article_modified_time":"2021-04-15T09:05:56+00:00","author":"\u5e38\u8f69","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u5e38\u8f69","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.changxuan.top\/?p=1238#article","isPartOf":{"@id":"https:\/\/www.changxuan.top\/?p=1238"},"author":{"name":"\u5e38\u8f69","@id":"https:\/\/www.changxuan.top\/#\/schema\/person\/08c8f0af44536928094dc1b4f88da3bd"},"headline":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d","datePublished":"2021-01-30T08:33:02+00:00","dateModified":"2021-04-15T09:05:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.changxuan.top\/?p=1238"},"wordCount":11,"commentCount":0,"publisher":{"@id":"https:\/\/www.changxuan.top\/#\/schema\/person\/08c8f0af44536928094dc1b4f88da3bd"},"keywords":["Redis","\u5206\u5e03\u5f0f\u9501"],"articleSection":["\u6280\u672f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.changxuan.top\/?p=1238#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.changxuan.top\/?p=1238","url":"https:\/\/www.changxuan.top\/?p=1238","name":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d - \u5e38\u8f69","isPartOf":{"@id":"https:\/\/www.changxuan.top\/#website"},"datePublished":"2021-01-30T08:33:02+00:00","dateModified":"2021-04-15T09:05:56+00:00","breadcrumb":{"@id":"https:\/\/www.changxuan.top\/?p=1238#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.changxuan.top\/?p=1238"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.changxuan.top\/?p=1238#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.changxuan.top\/"},{"@type":"ListItem","position":2,"name":"\u3010Redis \u5206\u5e03\u5f0f\u9501\u3011\uff082\uff09\u597d\u7528\u4e00\u70b9\u7684\u201c\u9501\u201d"}]},{"@type":"WebSite","@id":"https:\/\/www.changxuan.top\/#website","url":"https:\/\/www.changxuan.top\/","name":"\u5e38\u8f69","description":"\u95fb\u9053\u6709\u5148\u540e\uff0c\u672f\u4e1a\u6709\u4e13\u653b-\u4e00\u4e8c\u4e09","publisher":{"@id":"https:\/\/www.changxuan.top\/#\/schema\/person\/08c8f0af44536928094dc1b4f88da3bd"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.changxuan.top\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.changxuan.top\/#\/schema\/person\/08c8f0af44536928094dc1b4f88da3bd","name":"\u5e38\u8f69","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.changxuan.top\/wp-content\/uploads\/2021\/04\/IMG_008520200606-095631.jpg","url":"https:\/\/www.changxuan.top\/wp-content\/uploads\/2021\/04\/IMG_008520200606-095631.jpg","contentUrl":"https:\/\/www.changxuan.top\/wp-content\/uploads\/2021\/04\/IMG_008520200606-095631.jpg","width":960,"height":960,"caption":"\u5e38\u8f69"},"logo":{"@id":"https:\/\/www.changxuan.top\/wp-content\/uploads\/2021\/04\/IMG_008520200606-095631.jpg"},"description":"\u603b\u8981\u505a\u70b9\u4ec0\u4e48\u5427\uff01","sameAs":["https:\/\/www.changxuan.top"],"url":"https:\/\/www.changxuan.top\/?author=1"}]}},"views":1286,"_links":{"self":[{"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/posts\/1238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1238"}],"version-history":[{"count":7,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/posts\/1238\/revisions"}],"predecessor-version":[{"id":1344,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=\/wp\/v2\/posts\/1238\/revisions\/1344"}],"wp:attachment":[{"href":"https:\/\/www.changxuan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.changxuan.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}