{"id":201646,"date":"2025-05-10T10:08:46","date_gmt":"2025-05-10T02:08:46","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201646\/"},"modified":"2025-05-10T10:08:46","modified_gmt":"2025-05-10T02:08:46","slug":"redis%e7%a7%92%e6%9d%80%e5%ae%9e%e7%8e%b0%e6%96%b9%e6%a1%88%e8%ae%b2%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/201646\/","title":{"rendered":"Redis\u79d2\u6740\u5b9e\u73b0\u65b9\u6848\u8bb2\u89e3"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Redis\u79d2\u6740\u5b9e\u73b0\u65b9\u6848\u8bb2\u89e3<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587<span style=\"color: #FF6600;font-family:\">\u300aRedis\u79d2\u6740\u5b9e\u73b0\u65b9\u6848\u8bb2\u89e3\u300b<\/span>\u4e3b\u8981\u8bb2\u89e3\u4e86<span style=\"color: #FF6600;font-family:\">redis\u79d2\u6740<\/span>\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728golang\u5b66\u4e60\u7f51\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<h2>\u4e00\u3001\u5168\u5c40\u552f\u4e00ID<\/h2>\n<p>\uff081\uff09\u5b9a\u4e49<\/p>\n<p>\u5168\u5c40ID\u751f\u6210\u5668\uff0c\u662f\u4e00\u79cd\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e0b\u7528\u6765\u751f\u6210\u5168\u5c40\u552f\u4e00ID\u7684\u5de5\u5177\uff0c\u4e00\u534a\u6ee1\u8db3\u4e0b\u5217\u7279\u6027\uff1a<\/p>\n<ul>\n<li>\u552f\u4e00\u6027<\/li>\n<li>\u9ad8\u53ef\u7528<\/li>\n<li>\u9ad8\u6027\u80fd<\/li>\n<li>\u9012\u589e\u6027<\/li>\n<li>\u5b89\u5168\u6027<\/li>\n<\/ul>\n<p>\u4e3a\u4e86\u589e\u52a0ID\u7684\u5b89\u5168\u6027\uff0c\u6211\u4eec\u4e0d\u76f4\u63a5\u4f7f\u7528Redis\u81ea\u589e\u7684\u6570\u503c\uff0c\u800c\u662f\u62fc\u63a5\u4e00\u4e9b\u5176\u4ed6\u7684\u4fe1\u606f\u3002<\/p>\n<p>ID\u7684\u7ec4\u6210\u90e8\u5206\uff1a<\/p>\n<ul>\n<li>\u7b26\u53f7\u4f4d\uff1a1bit\uff0c\u6c38\u8fdc\u4e3a0<\/li>\n<li>\u65f6\u95f4\u6233\uff1a31bit\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c\u53ef\u4ee5\u4f7f\u752869\u5e74<\/li>\n<li>\u5e8f\u5217\u53f7\uff1a32bit\uff0c\u79d2\u5185\u8ba1\u6570\u5668\uff0c\u652f\u6301\u6bcf\u79d2\u4ea7\u751f2\u207f32\u4e2a\u4e0d\u540c\u7684ID<\/li>\n<\/ul>\n<p>\uff082\uff09\u4ee3\u7801\u5b9e\u73b0<\/p>\n<pre>@Component\npublic class RedisIdWorker {\n    \/**\n     * \u5f00\u59cb\u65f6\u95f4\u6233\n     *\/\n    private static final long BEGIN_TIMESTAMP = 1640995200L;\n    \/**\n     * \u5e8f\u5217\u53f7\u7684\u4f4d\u6570\n     *\/\n    private static final int COUNT_BITS = 32;\n    @Autowired\n    private StringRedisTemplate stringRedisTemplate;\n    public long nextId(String keyPrefix) {\n        \/\/ 1.\u751f\u6210\u65f6\u95f4\u6233\n        LocalDateTime now = LocalDateTime.now();\n        long nowSecond = now.toEpochSecond(ZoneOffset.UTC);\n        long timestamp = nowSecond - BEGIN_TIMESTAMP;\n        \/\/ 2.\u751f\u6210\u5e8f\u5217\u53f7\n        \/\/ 2.1.\u83b7\u53d6\u5f53\u524d\u65e5\u671f\uff0c\u7cbe\u786e\u5230\u5929\n        String date = now.format(DateTimeFormatter\n        \t\t\t\t\t\t.ofPattern(\"yyyy:MM:dd\"));\n        \/\/ 2.2.\u81ea\u589e\u957f\n        long count = stringRedisTemplate.opsForValue()\n        \t\t\t\t\t.increment(\"icr:\" + keyPrefix + \":\" + date);\n        \/\/ 3.\u62fc\u63a5\u5e76\u8fd4\u56de\n        return timestamp \n<p>\uff083\uff09\u603b\u7ed3<\/p>\n<p>\u5168\u5c40\u552f\u4e00ID\u751f\u6210\u7b56\u7565\uff1a<\/p>\n<\/pre>\n<ul>\n<li>UUID<\/li>\n<li>Redis\u81ea\u589e<\/li>\n<li>\u96ea\u82b1\u7b97\u6cd5<\/li>\n<li>\u6570\u636e\u5e93\u81ea\u589e<\/li>\n<\/ul>\n<p>Redis\u81ea\u589eID\u7b56\u7565\uff1a<\/p>\n<ul>\n<li>\u6bcf\u5929\u4e00\u4e2akey\uff0c\u65b9\u4fbf\u7edf\u8ba1<\/li>\n<li>ID\u6784\u9020\u662f\u65f6\u95f4\u6233 + \u8ba1\u6570\u5668<\/li>\n<\/ul>\n<h2>\u4e8c\u3001\u8d85\u5356\u95ee\u9898<\/h2>\n<h3>1\u3001\u89e3\u51b3\u529e\u6cd5<\/h3>\n<p>\u8d85\u5356\u95ee\u9898\u662f\u5178\u578b\u7684\u591a\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\uff0c\u9488\u5bf9\u8fd9\u4e00\u95ee\u9898\u7684\u5e38\u89c1\u89e3\u51b3\u65b9\u6848\u5c31\u662f\u52a0\u9501\uff1a<\/p>\n<p>\u60b2\u89c2\u9501<\/p>\n<p>\u8ba4\u4e3a\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u4e00\u5b9a\u4f1a\u53d1\u751f\uff0c\u56e0\u6b64\u5728\u64cd\u4f5c\u6570\u636e\u4e4b\u524d\u5148\u83b7\u53d6\u9501\uff0c\u786e\u4fdd\u7ebf\u7a0b\u4e32\u884c\u6267\u884c\u3002\u4f8b\u5982Synchronized\u3001Lock\u90fd\u5c5e\u4e8e\u60b2\u89c2\u9501<\/p>\n<p>\u4e50\u89c2\u9501<\/p>\n<p>\u8ba4\u4e3a\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u4e0d\u4e00\u5b9a\u4f1a\u53d1\u751f\uff0c\u56e0\u6b64\u4e0d\u52a0\u9501\uff0c\u53ea\u662f\u5728\u66f4\u65b0\u6570\u636e\u65f6\u53bb\u5224\u65ad\u6709\u6ca1\u6709\u5176\u4ed6\u7ebf\u7a0b\u5bf9\u6570\u636e\u8fdb\u884c\u4e86\u4fee\u6539\u3002\u5982\u679c\u6ca1\u6709\u4fee\u6539\u5219\u8ba4\u4e3a\u662f\u5b89\u5168\u7684\uff0c\u81ea\u5df1\u624d\u66f4\u65b0\u6570\u636e\uff1b\u5982\u679c\u5df2\u7ecf\u88ab\u5176\u4ed6\u7ebf\u7a0b\u4fee\u6539\uff0c\u8bf4\u660e\u4e86\u5b89\u5168\u95ee\u9898\uff0c\u6b64\u65f6\u53ef\u4ee5\u91cd\u8bd5\u6216\u5f02\u5e38\u3002<\/p>\n<h3>2\u3001\u4e50\u89c2\u9501<\/h3>\n<p>\u4e50\u89c2\u9501\u7684\u5173\u952e\u662f\u5224\u65ad\u4e4b\u524d\u67e5\u8be2\u5f97\u5230\u7684\u6570\u636e\u662f\u5426\u6709\u88ab\u4fee\u6539\u8fc7\uff0c\u5e38\u89c1\u7684\u65b9\u5f0f\u6709\u4e24\u79cd\uff1a<\/p>\n<p>\uff081\uff09\u7248\u672c\u53f7\u6cd5<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324363f976bb5e984.png\" class=\"aligncenter\"><\/p>\n<p>\uff082\uff09CAS\u6cd5<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324363f976bbdae94.png\" class=\"aligncenter\"><\/p>\n<p>\uff083\uff09\u603b\u7ed3<\/p>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u60b2\u89c2\u9501<\/th>\n<th>\u4e50\u89c2\u9501<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u65b9\u6848<\/td>\n<td>\u6dfb\u52a0\u540c\u6b65\u9501\uff0c\u8ba9\u7ebf\u7a0b\u4e32\u884c\u6267\u884c<\/td>\n<td>\u4e0d\u52a0\u9501\uff0c\u5728\u66f4\u65b0\u65f6\u5224\u65ad\u662f\u5426\u6709\u5176\u4ed6\u7ebf\u7a0b\u5728\u4fee\u6539<\/td>\n<\/tr>\n<tr>\n<td>\u4f18\u70b9<\/td>\n<td>\u7b80\u5355\u7c97\u66b4<\/td>\n<td>\u6027\u80fd\u597d<\/td>\n<\/tr>\n<tr>\n<td>\u7f3a\u70b9<\/td>\n<td>\u6027\u80fd\u4e00\u822c<\/td>\n<td>\u5b58\u5728\u6210\u529f\u7387\u4f4e\u7684\u95ee\u9898<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u56db\u3001\u5206\u5e03\u5f0f\u9501<\/h2>\n<p>\u4f20\u9001\u95e8<\/p>\n<h2>\u4e94\u3001Reids\u4f18\u5316\u79d2\u6740\u2014\u5f02\u6b65\u6267\u884c<\/h2>\n<h3>1\u3001\u601d\u8def<\/h3>\n<p>\uff081\uff09Lua\u811a\u672c\u903b\u8f91<\/p>\n<p>\u5224\u65ad\u5e93\u5b58\u662f\u5426\u5145\u8db3\uff1a\u5229\u7528String\u7c7b\u578b<\/p>\n<p>\u5224\u65ad\u7528\u6237\u662f\u5426\u4e0b\u5355\uff1a\u5229\u7528Set\u7c7b\u578b<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324463f976bc237af.png\" class=\"aligncenter\"><\/p>\n<p>\uff082\uff09java\u6267\u884cLua\u811a\u672c\u903b\u8f91<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324463f976bc722c4.png\" class=\"aligncenter\"><\/p>\n<p>\uff083\uff09\u4ee3\u7801<\/p>\n<blockquote>\n<p>&#8212; 1.\u53c2\u6570\u5217\u8868<br \/>&#8212; 1.1.\u4f18\u60e0\u5238id<br \/>local voucherId = ARGV[1]<br \/>&#8212; 1.2.\u7528\u6237id<br \/>local userId = ARGV[2]<\/p>\n<p>&#8212; 2.\u6570\u636ekey<br \/>&#8212; 2.1.\u5e93\u5b58key<br \/>local stockKey = &#8216;seckill:stock:&#8217; .. voucherId<br \/>&#8212; 2.2.\u8ba2\u5355key<br \/>local orderKey = &#8216;seckill:order:&#8217; .. voucherId<\/p>\n<p>&#8212; 3.\u811a\u672c\u4e1a\u52a1<br \/>&#8212; 3.1.\u5224\u65ad\u5e93\u5b58\u662f\u5426\u5145\u8db3 get stockKey<br \/>if(tonumber(redis.call(&#8216;get&#8217;, stockKey)) &nbsp; &nbsp; &#8212; 3.2.\u5e93\u5b58\u4e0d\u8db3\uff0c\u8fd4\u56de1<br \/>&nbsp; &nbsp; return 1<br \/>end<br \/>&#8212; 3.2.\u5224\u65ad\u7528\u6237\u662f\u5426\u4e0b\u5355 SISMEMBER orderKey userId<br \/>if(redis.call(&#8216;sismember&#8217;, orderKey, userId) == 1) then<br \/>&nbsp; &nbsp; &#8212; 3.3.\u5b58\u5728\uff0c\u8bf4\u660e\u662f\u91cd\u590d\u4e0b\u5355\uff0c\u8fd4\u56de2<br \/>&nbsp; &nbsp; return 2<br \/>end<br \/>&#8212; 3.4.\u6263\u5e93\u5b58 incrby stockKey -1<br \/>redis.call(&#8216;incrby&#8217;, stockKey, -1)<br \/>&#8212; 3.5.\u4e0b\u5355\uff08\u4fdd\u5b58\u7528\u6237\uff09sadd orderKey userId<br \/>redis.call(&#8216;sadd&#8217;, orderKey, userId)<br \/>return 0<\/p>\n<\/blockquote>\n<pre>    private static final DefaultRedisScript\n   \n     SECKILL_SCRIPT;\n    static {\n        SECKILL_SCRIPT = new DefaultRedisScript();\n        SECKILL_SCRIPT.setLocation(new ClassPathResource(\"seckill.lua\"));\n        SECKILL_SCRIPT.setResultType(Long.class);\n    }\n    @Override\n    public Result seckillVoucher(Long voucherId) {\n        Long userId = UserHolder.getUser().getId();\n        long orderId = redisIdWorker.nextId(\"order\");\n        \/\/ 1.\u6267\u884clua\u811a\u672c\n        Long result = stringRedisTemplate.execute(\n                SECKILL_SCRIPT,\n                Collections.emptyList(),\n                voucherId.toString(), userId.toString()\n        );\n        int r = result.intValue();\n        \/\/ 2.\u5224\u65ad\u7ed3\u679c\u662f\u5426\u4e3a0\n        if (r != 0) {\n            \/\/ 2.1.\u4e0d\u4e3a0 \uff0c\u4ee3\u8868\u6ca1\u6709\u8d2d\u4e70\u8d44\u683c\n            return Result.fail(r == 1 ? \"\u5e93\u5b58\u4e0d\u8db3\" : \"\u4e0d\u80fd\u91cd\u590d\u4e0b\u5355\");\n        }\n        \/\/ 3.\u53d1\u9001\u6d88\u606f\u961f\u5217 \u5f02\u6b65\n        \/\/ 4.\u8fd4\u56de\u8ba2\u5355id\n        return Result.ok(orderId);\n    }\n   <\/pre>\n<h2>\u516d\u3001\u6d88\u606f\u961f\u5217<\/h2>\n<p>\u6d88\u606f\u961f\u5217\uff08Message Queue\uff09,\u5b57\u9762\u610f\u601d\u5c31\u662f\u5b58\u653e\u6d88\u606f\u7684\u961f\u5217\u3002\u6700\u7b80\u5355\u7684\u6d88\u606f\u961f\u5217\u6a21\u578b\u5305\u62ec3\u4e2a\u89d2\u8272\uff1a<\/p>\n<ul>\n<li>\u6d88\u606f\u961f\u5217\uff1a\u5b58\u50a8\u548c\u7ba1\u7406\u6d88\u606f\uff0c\u4e5f\u88ab\u6210\u4e3a\u6d88\u606f\u4ee3\u7406\u3002<\/li>\n<li>\u751f\u4ea7\u8005\uff1a\u53d1\u9001\u6d88\u606f\u5bfc\u6d88\u606f\u961f\u5217<\/li>\n<li>\u6d88\u8d39\u8005\uff1a\u4ece\u6d88\u606f\u961f\u5217\u83b7\u53d6\u6d88\u606f\u5e76\u5904\u7406\u6d88\u606f\u3002<\/li>\n<\/ul>\n<p>Redis\u63d0\u4f9b\u4e86\u4e09\u79cd\u4e0d\u540c\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u6d88\u606f\u961f\u5217\uff1a<\/p>\n<ul>\n<li>list\u7ed3\u6784\uff1a\u57fa\u4e8eLiist\u7ed3\u6784\u6a21\u62df\u6d88\u606f\u961f\u5217<\/li>\n<li>PubSub\uff1a\u57fa\u672c\u7684\u70b9\u5bf9\u70b9\u6d88\u606f\u6a21\u578b<\/li>\n<li>Stream\uff1a\u6bd4\u8f83\u5b8c\u5584\u7684\u6d88\u606f\u961f\u5217\u6a21\u578b<\/li>\n<\/ul>\n<h3>1\u3001\u57fa\u4e8eList\u7ed3\u6784\u6a21\u62df\u6d88\u606f\u961f\u5217<\/h3>\n<p>\u6d88\u606f\u961f\u5217\u5c31\u662f\u5b58\u653e\u6d88\u606f\u7684\u961f\u5217\u3002\u800cRedis\u7684List\u6570\u636e\u7ed3\u6784\u662f\u4e00\u4e2a\u53cc\u5411\u94fe\u8868\uff0c\u5f88\u5bb9\u6613\u6a21\u62df\u3002<\/p>\n<p>\u961f\u5217\u662f\u5165\u53e3\u548c\u51fa\u53e3\u4e0d\u5728\u4e00\u8fb9\uff0c\u56e0\u6b64\u53ef\u4ee5\u5229\u7528LPUSH\u7ed3\u5408RPOP\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u5b9e\u73b0\u963b\u585e\u6548\u679c\uff0c\u5e94\u8be5\u4f7f\u7528BRPOP\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"height:22px;text-align:center;width:33px\"><\/th>\n<th style=\"height:22px;text-align:center;width:515px\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center;width:33px\">\u4f18\u70b9<\/td>\n<td style=\"text-align:center;width:515px\">1\u3001\u5229\u7528Redis\u5b58\u50a8\uff0c\u4e0d\u53d7\u9650\u4e8eJVM\u5185\u5b58\u4e0a\u9650\uff1b 2\u3001\u57fa\u4e8eRedis\u7684\u6301\u4e45\u5316\u673a\u5236\uff0c\u6570\u636e\u5b89\u5168\u6027\u6709\u4fdd\u969c 3\u3001\u53ef\u4ee5\u6ee1\u8db3\u6d88\u606f\u6709\u5e8f\u6027<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center;width:33px\">\u7f3a\u70b9<\/td>\n<td style=\"text-align:center;width:515px\">1\u3001\u65e0\u6cd5\u907f\u514d\u6d88\u606f\u4e22\u5931 2\u3001\u53ea\u652f\u6301\u5355\u6d88\u8d39\u8005<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2\u3001PubSub<\/h3>\n<p>\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\uff0c\u6d88\u8d39\u8005\u53ef\u4ee5\u8ba2\u9605\u4e00\u4e2a\u6216\u591a\u4e2achannel\uff0c\u751f\u4ea7\u8005\u5411\u5bf9\u5e94channel\u53d1\u9001\u6d88\u606f\u540e\uff0c\u6240\u6709\u8ba2\u9605\u8005\u90fd\u80fd\u6536\u5230\u76f8\u5173\u6d88\u606f\u3002<\/p>\n<ul>\n<li>SUBSCRIBE channel [channel] \uff1a\u8ba2\u9605\u4e00\u4e2a\u6216\u591a\u4e2a\u9891\u9053<\/li>\n<li>PUBLISH channel msg: \u5411\u4e00\u4e2a\u9891\u9053\u53d1\u9001\u6d88\u606f<\/li>\n<li>PSUBSCRIBE pattern [pattern] :\u8ba2\u9605\u4e0epattern\u683c\u5f0f\u5339\u914d\u7684\u6240\u6709\u9891\u9053<\/li>\n<\/ul>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324463f976bcbae84.png\" class=\"aligncenter\"><\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\"><\/th>\n<th style=\"text-align:center\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u4f18\u70b9<\/td>\n<td style=\"text-align:center\">1\u3001\u91c7\u7528\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\uff0c\u652f\u6301\u591a\u751f\u4ea7\u3001\u591a\u6d88\u8d39<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u7f3a\u70b9<\/td>\n<td style=\"text-align:center\">1\u3001\u4e0d\u652f\u6301\u6570\u636e\u6301\u4e45\u5316 2\u3001\u65e0\u6cd5\u907f\u514d\u6d88\u606f\u4e22\u5931 3\u3001\u6d88\u606f\u5806\u79ef\u6709\u4e0a\u9650\uff0c\u8d85\u51fa\u65f6\u6570\u636e\u4e22\u5931<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3\u3001Stream<\/h3>\n<p>\uff081\uff09\u57fa\u672c\u7528\u6cd5<\/p>\n<p>\u662fRedis 5.0\u5f15\u5165\u7684\u65b0\u6570\u636e<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324563f976bd287db.png\" class=\"aligncenter\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324563f976bd7b991.png\" class=\"aligncenter\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324563f976bdce4cd.png\" class=\"aligncenter\"><\/p>\n<p>\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u6d88\u606f\u53ef\u56de\u6eaf\u4e00\u4e2a\u6d88\u606f\u53ef\u4ee5\u88ab\u591a\u4e2a\u6d88\u8d39\u8005\u8bfb\u53d6<\/li>\n<li>\u53ef\u4ee5\u963b\u585e\u8bfb\u53d6<\/li>\n<li>\u6709\u6d88\u606f\u6f0f\u8bfb\u7684\u98ce\u9669<\/li>\n<\/ul>\n<p>\uff082\uff09\u6d88\u8d39\u8005\u7ec4<\/p>\n<p>\u6d88\u8d39\u8005\u7ec4\uff08Consumer Group\uff09\uff1a\u5c06\u591a\u4e2a\u6d88\u8d39\u8005\u5212\u5206\u5230\u4e00\u4e2a\u7ec4\u4e2d\uff0c\u76d1\u542c\u540c\u4e00\u4e2a\u961f\u5217\u3002\u7279\u70b9\u5982\u4e0b\uff1a<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324663f976be1d1d1.png\" class=\"aligncenter\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324663f976be626cb.png\" class=\"aligncenter\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324663f976beaabef.png\" class=\"aligncenter\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324663f976bee31a2.png\" class=\"aligncenter\"><\/p>\n<p>\u786e\u8ba4pending-list<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324763f976bf2eb54.png\" class=\"aligncenter\"><\/p>\n<p>\u67e5\u770bpendingList<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20230225\/167729324763f976bf8d59a.png\" class=\"aligncenter\"><\/p>\n<p>\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u6d88\u606f\u53ef\u56de\u6eaf<\/li>\n<li>\u53ef\u4ee5\u591a\u6d88\u8d39\u8005\u4e89\u62a2\u6d88\u606f\uff0c\u52a0\u5feb\u6d88\u8d39\u901f\u5ea6<\/li>\n<li>\u53ef\u4ee5\u963b\u585e\u8bfb\u53d6<\/li>\n<li>\u6ca1\u6709\u6d88\u606f\u6f0f\u8bfb\u7684\u98ce\u9669<\/li>\n<li>\u6709\u6d88\u606f\u786e\u8ba4\u673a\u5236\uff0c\u4fdd\u8bc1\u6d88\u606f\u81f3\u5c11\u88ab\u6d88\u8d39\u4e00\u6b21<\/li>\n<\/ul>\n<h3>4\u3001\u6bd4\u8f83<\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\"><\/th>\n<th style=\"text-align:center\">List<\/th>\n<th style=\"text-align:center\">PubSub<\/th>\n<th style=\"text-align:center\">Stream<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u6d88\u606f\u6301\u4e45\u5316<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u4e0d\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u963b\u585e\u8bfb\u53d6<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6d88\u606f\u5806\u79ef\u5904\u7406<\/td>\n<td style=\"text-align:center\">\u53d7\u9650\u4e8e\u5185\u5b58\u7a7a\u95f4\uff0c\u53ef\u4ee5\u5229\u7528\u591a\u6d88\u8d39\u8005\u52a0\u5feb\u5904\u7406<\/td>\n<td style=\"text-align:center\">\u53d7\u9650\u4e8e\u6d88\u8d39\u8005\u7f13\u51b2\u533a<\/td>\n<td style=\"text-align:center\">\u53d7\u9650\u4e8e\u961f\u5217\u957f\u5ea6\uff0c\u53ef\u4ee5\u5229\u7528\u6d88\u8d39\u8005\u7ec4\u63d0\u9ad8\u6d88\u606f\u901f\u5ea6\uff0c\u51cf\u5c11\u5806\u79ef<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6d88\u606f\u56de\u6eaf<\/td>\n<td style=\"text-align:center\">\u4e0d\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u4e0d\u652f\u6301<\/td>\n<td style=\"text-align:center\">\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Redis\u79d2\u6740\u5b9e\u73b0\u65b9\u6848\u8bb2\u89e3 \u6536\u85cf&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-201646","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=201646"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201646\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}