{"id":201786,"date":"2025-05-10T11:31:52","date_gmt":"2025-05-10T03:31:52","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201786\/"},"modified":"2025-05-10T11:31:52","modified_gmt":"2025-05-10T03:31:52","slug":"redis%e4%b9%90%e8%a7%82%e9%94%81%e4%b8%8e%e6%82%b2%e8%a7%82%e9%94%81%e7%9a%84%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/201786\/","title":{"rendered":"redis\u4e50\u89c2\u9501\u4e0e\u60b2\u89c2\u9501\u7684\u5b9e\u6218\u00a0"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>redis\u4e50\u89c2\u9501\u4e0e\u60b2\u89c2\u9501\u7684\u5b9e\u6218&nbsp;<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u5728\u6570\u636e\u5e93\u5b9e\u6218\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u4e00\u4e9b\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u7136\u540e\u8981\u5361\u597d\u534a\u5929\uff0c\u7b49\u95ee\u9898\u89e3\u51b3\u4e86\u624d\u53d1\u73b0\u539f\u6765\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u662f\u6ca1\u6709\u638c\u63e1\u597d\u3002\u4eca\u5929golang\u5b66\u4e60\u7f51\u5c31\u6574\u7406\u5206\u4eab\u300aredis\u4e50\u89c2\u9501\u4e0e\u60b2\u89c2\u9501\u7684\u5b9e\u6218&nbsp;\u300b\uff0c\u804a\u804a\u60b2\u89c2\u9501\u3001redis\u4e50\u89c2\u9501\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u6b63\u5728\u52aa\u529b\u8d5a\u94b1\u7684\u4f60\u3002<\/p>\n<h2>\u6982\u5ff5<\/h2>\n<p>Redis\u662f\u4e00\u4e2a\u5185\u5b58\u4e2d\u7684\u952e\u503c\u5b58\u50a8\u7cfb\u7edf\uff0c\u652f\u6301\u591a\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u5982\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u3001\u5217\u8868\u7b49\u3002Redis\u63d0\u4f9b\u4e86\u4e24\u79cd\u9501\u673a\u5236\uff0c\u5373\u4e50\u89c2\u9501\u548c\u60b2\u89c2\u9501\u3002<\/p>\n<h2>\u4e50\u89c2\u9501<\/h2>\n<p>\u4e50\u89c2\u9501\u662f\u4e00\u79cd\u4e50\u89c2\u7684\u5e76\u53d1\u63a7\u5236\u7b56\u7565\uff0c\u5b83\u8ba4\u4e3a\u6570\u636e\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u88ab\u5176\u4ed6\u7ebf\u7a0b\u5360\u7528\uff0c\u56e0\u6b64\u6bcf\u6b21\u9700\u8981\u4fee\u6539\u6570\u636e\u65f6\uff0c\u90fd\u4e0d\u4f1a\u83b7\u53d6\u9501\uff0c\u800c\u662f\u76f4\u63a5\u8fdb\u884c\u4fee\u6539\u3002\u5728Redis\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7WATCH\u548cCAS\u547d\u4ee4\u6765\u5b9e\u73b0\u4e50\u89c2\u9501\uff0cWATCH\u547d\u4ee4\u7528\u4e8e\u76d1\u89c6\u4e00\u4e2a\u6216\u591a\u4e2a\u952e\uff0cCAS\u547d\u4ee4\u7528\u4e8e\u68c0\u67e5\u5e76\u66f4\u65b0\u952e\u7684\u503c\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5047\u8bbe\u6709\u4e00\u4e2a\u8ba1\u6570\u5668\u952ecounter\uff0c\u591a\u4e2a\u5ba2\u6237\u7aef\u90fd\u9700\u8981\u5bf9\u5176\u8fdb\u884c\u64cd\u4f5c\u3002\u4f7f\u7528\u4e50\u89c2\u9501\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u6bcf\u4e2a\u5ba2\u6237\u7aef\u6267\u884c\u64cd\u4f5c\u4e4b\u524d\uff0c\u5148\u901a\u8fc7WATCH\u547d\u4ee4\u76d1\u89c6counter\u952e\uff1a<\/p>\n<pre>WATCH counter\ncurrent_count = GET counter\nnew_count = current_count + 1\nMULTI\nSET counter new_count\nEXEC\n<\/pre>\n<p>\u7136\u540e\uff0c\u5728EXEC\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u4f7f\u7528GET\u547d\u4ee4\u518d\u6b21\u83b7\u53d6counter\u952e\u7684\u503c\uff0c\u5e76\u5c06\u5176\u4e0e\u4e4b\u524d\u83b7\u53d6\u7684\u503c\u8fdb\u884c\u6bd4\u8f83\u3002\u5982\u679c\u503c\u76f8\u7b49\uff0c\u5c31\u8bf4\u660e\u671f\u95f4\u6ca1\u6709\u5176\u4ed6\u5ba2\u6237\u7aef\u5bf9counter\u952e\u8fdb\u884c\u4e86\u4fee\u6539\uff0c\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528CAS\u547d\u4ee4\u5c06\u65b0\u503c\u8bbe\u7f6e\u5230counter\u952e\u4e2d\u3002\u5982\u679c\u503c\u4e0d\u76f8\u7b49\uff0c\u5219\u8bf4\u660e\u671f\u95f4\u6709\u5176\u4ed6\u5ba2\u6237\u7aef\u5bf9counter\u952e\u8fdb\u884c\u4e86\u4fee\u6539\uff0c\u9700\u8981\u91cd\u65b0\u6267\u884c\u64cd\u4f5c\u3002<\/p>\n<pre>GET counter\n<\/pre>\n<h2>\u60b2\u89c2\u9501<\/h2>\n<p>\u60b2\u89c2\u9501\u662f\u4e00\u79cd\u60b2\u89c2\u7684\u5e76\u53d1\u63a7\u5236\u7b56\u7565\uff0c\u5b83\u8ba4\u4e3a\u6570\u636e\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u90fd\u4f1a\u88ab\u5176\u4ed6\u7ebf\u7a0b\u5360\u7528\uff0c\u56e0\u6b64\u6bcf\u6b21\u9700\u8981\u4fee\u6539\u6570\u636e\u65f6\uff0c\u90fd\u4f1a\u5148\u83b7\u53d6\u9501\uff0c\u786e\u4fdd\u5728\u4fee\u6539\u671f\u95f4\u6ca1\u6709\u5176\u4ed6\u7ebf\u7a0b\u53ef\u4ee5\u8bbf\u95ee\u8be5\u6570\u636e\u3002\u5728Redis\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7WATCH\u547d\u4ee4\u6765\u5b9e\u73b0\u60b2\u89c2\u9501\uff0c\u8be5\u547d\u4ee4\u53ef\u4ee5\u76d1\u89c6\u4e00\u4e2a\u6216\u591a\u4e2a\u952e\uff0c\u5982\u679c\u5728\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u6709\u4efb\u4f55\u88ab\u76d1\u89c6\u952e\u7684\u503c\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u6574\u4e2a\u4e8b\u52a1\u4f1a\u88ab\u56de\u6eda\u3002<\/p>\n<p>\u8fd8\u662f\u4e0a\u6587\u7684\u4f8b\u5b50<\/p>\n<pre>WATCH counter\ncurrent_count = GET counter\nnew_count = current_count + 1\nMULTI\nSET counter new_count\nEXEC\n<\/pre>\n<p>\u5982\u679c\u5728\u6267\u884c\u4e8b\u52a1\u671f\u95f4\uff0c\u6709\u5176\u4ed6\u5ba2\u6237\u7aef\u4fee\u6539\u4e86counter\u952e\uff0c\u90a3\u4e48\u6574\u4e2a\u4e8b\u52a1\u4f1a\u88ab\u56de\u6eda\uff0c\u9700\u8981\u91cd\u65b0\u6267\u884c\u3002<\/p>\n<p>\u60b2\u89c2\u9501\u7684\u4f18\u70b9\u5728\u4e8e\u5b83\u53ef\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u4e00\u81f4\u6027\uff0c\u4f46\u7f3a\u70b9\u5728\u4e8e\u5b83\u9700\u8981\u83b7\u53d6\u9501\uff0c\u53ef\u80fd\u4f1a\u5f15\u8d77\u7ebf\u7a0b\u7684\u963b\u585e\uff0c\u5f71\u54cd\u5e76\u53d1\u6027\u80fd\u3002<\/p>\n<h2>\u4e50\u89c2\u9501\u793a\u4f8b<\/h2>\n<p>\u5047\u8bbe\u6709\u4e00\u4e2a\u7535\u5546\u5e73\u53f0\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u5e73\u53f0\u4e0a\u8d2d\u4e70\u5546\u54c1\u3002\u4e3a\u4e86\u4fdd\u8bc1\u6570\u636e\u7684\u4e00\u81f4\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Redis\u7684\u4e50\u89c2\u9501\u6765\u5b9e\u73b0\u5546\u54c1\u5e93\u5b58\u7684\u6263\u51cf\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728Redis\u4e2d\u4fdd\u5b58\u6bcf\u4e2a\u5546\u54c1\u7684\u5e93\u5b58\u4fe1\u606f\uff0c\u4f7f\u7528hash\u6570\u636e\u7ed3\u6784\u6765\u4fdd\u5b58\uff0c\u4f8b\u5982\uff1a<\/p>\n<p>\u7136\u540e\uff0c\u5728\u4e1a\u52a1\u903b\u8f91\u4e2d\uff0c\u5f53\u7528\u6237\u8d2d\u4e70\u4e00\u4e2a\u5546\u54c1\u65f6\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528WATCH\u547d\u4ee4\u76d1\u89c6\u5546\u54c1\u5e93\u5b58\u952e\uff0c\u4f8b\u5982stock:sku001\uff1b<\/li>\n<li>\u4f7f\u7528GET\u547d\u4ee4\u83b7\u53d6\u5f53\u524d\u5546\u54c1\u5e93\u5b58\u6570\u91cf\uff1b<\/li>\n<li>\u68c0\u67e5\u5546\u54c1\u5e93\u5b58\u662f\u5426\u8db3\u591f\uff0c\u5982\u679c\u4e0d\u8db3\uff0c\u76f4\u63a5\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\uff1b<\/li>\n<li>\u8ba1\u7b97\u65b0\u7684\u5e93\u5b58\u6570\u91cf\uff0c\u5e76\u4f7f\u7528MULTI\u547d\u4ee4\u5f00\u542f\u4e00\u4e2a\u4e8b\u52a1\uff1b<\/li>\n<li>\u4f7f\u7528HSET\u547d\u4ee4\u5c06\u65b0\u7684\u5e93\u5b58\u6570\u91cf\u4fdd\u5b58\u5230Redis\u4e2d\uff1b<\/li>\n<li>\u6267\u884c\u4e8b\u52a1\uff0c\u5982\u679c\u5728\u6267\u884c\u671f\u95f4\u6709\u5176\u4ed6\u5ba2\u6237\u7aef\u4fee\u6539\u4e86\u5546\u54c1\u5e93\u5b58\uff0c\u4f1a\u56de\u6eda\u4e8b\u52a1\uff0c\u9700\u8981\u91cd\u65b0\u6267\u884c\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4f7f\u7528Spring Boot\u5b9e\u73b0\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>@Service\npublic class OrderService {\n&nbsp; &nbsp; private final RedisTemplate\n   \n     redisTemplate;\n\n&nbsp; &nbsp; @Autowired\n&nbsp; &nbsp; public OrderService(RedisTemplate\n    \n      redisTemplate) { &nbsp; &nbsp; &nbsp; &nbsp; this.redisTemplate = redisTemplate; &nbsp; &nbsp; } &nbsp; &nbsp; public void placeOrder(String sku, int quantity) { &nbsp; &nbsp; &nbsp; &nbsp; String stockKey = \"stock:\" + sku; &nbsp; &nbsp; &nbsp; &nbsp; while (true) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u76d1\u89c6\u5546\u54c1\u5e93\u5b58\u952e\uff0c\u4ee5\u4fbf\u5728\u4e8b\u52a1\u5f00\u59cb\u524d\u68c0\u6d4b\u662f\u5426\u6709\u5176\u4ed6\u5ba2\u6237\u7aef\u4fee\u6539\u4e86\u5e93\u5b58 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; redisTemplate.watch(stockKey); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u83b7\u53d6\u5f53\u524d\u5e93\u5b58\u6570\u91cf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int currentStock = redisTemplate.opsForHash().get(stockKey, sku); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u68c0\u67e5\u5e93\u5b58\u662f\u5426\u8db3\u591f &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (currentStock results = redisTemplate.exec(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u5982\u679c\u4e8b\u52a1\u6267\u884c\u6210\u529f\uff0c\u5219\u9000\u51fa\u5faa\u73af &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (results != null) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u5982\u679c\u4e8b\u52a1\u6267\u884c\u5931\u8d25\uff0c\u5219\u91cd\u8bd5 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } }\n    \n   <\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528RedisTemplate\u6765\u64cd\u4f5cRedis\uff0c\u5176\u4e2dwatch\u65b9\u6cd5\u7528\u4e8e\u76d1\u89c6\u5546\u54c1\u5e93\u5b58\u952e\uff0copsForHash\u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6\u548c\u4fee\u6539\u5546\u54c1\u5e93\u5b58\u7684\u503c\uff0cmulti\u548cexec\u65b9\u6cd5\u7528\u4e8e\u5f00\u542f\u548c\u63d0\u4ea4\u4e8b\u52a1\u3002<\/p>\n<h2>\u60b2\u89c2\u9501\u793a\u4f8b<\/h2>\n<p>\u9664\u4e86\u4e50\u89c2\u9501\uff0cRedis\u8fd8\u652f\u6301\u60b2\u89c2\u9501\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eNX\uff08Not Exist\uff09\u6216XX\uff08Exist\uff09\u6807\u5fd7\u6765\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c\u5f53NX\u6807\u5fd7\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u5982\u679c\u9501\u4e0d\u5b58\u5728\uff0c\u4f1a\u8fd4\u56deOK\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u9501\uff1b\u5982\u679c\u9501\u5df2\u7ecf\u5b58\u5728\uff0c\u4f1a\u8fd4\u56denull\uff0c\u8868\u793a\u83b7\u53d6\u9501\u5931\u8d25\u3002\u53cd\u4e4b\uff0c\u5f53XX\u6807\u5fd7\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u5982\u679c\u9501\u5df2\u7ecf\u5b58\u5728\uff0c\u4f1a\u8fd4\u56deOK\uff0c\u8868\u793a\u83b7\u53d6\u9501\u6210\u529f\uff1b\u5982\u679c\u9501\u4e0d\u5b58\u5728\uff0c\u4f1a\u8fd4\u56denull\uff0c\u8868\u793a\u83b7\u53d6\u9501\u5931\u8d25\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4f7f\u7528Spring Boot\u5b9e\u73b0\u7684\u60b2\u89c2\u9501\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>@Service\npublic class OrderService {\n&nbsp; &nbsp; private final RedisTemplate\n   \n     redisTemplate;\n\n&nbsp; &nbsp; @Autowired\n&nbsp; &nbsp; public OrderService(RedisTemplate\n    \n      redisTemplate) { &nbsp; &nbsp; &nbsp; &nbsp; this.redisTemplate = redisTemplate; &nbsp; &nbsp; } &nbsp; &nbsp; public void placeOrder(String sku, int quantity) { &nbsp; &nbsp; &nbsp; &nbsp; String lockKey = \"lock:\" + sku; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u5c1d\u8bd5\u83b7\u53d6\u9501\uff0c\u5982\u679c\u9501\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf4\u660e\u6709\u5176\u4ed6\u7ebf\u7a0b\u6b63\u5728\u6267\u884c\u76f8\u5173\u64cd\u4f5c &nbsp; &nbsp; &nbsp; &nbsp; Boolean locked = redisTemplate.opsForValue().setIfAbsent(lockKey, \"locked\"); &nbsp; &nbsp; &nbsp; &nbsp; if (!locked) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u83b7\u53d6\u9501\u5931\u8d25\uff0c\u629b\u51fa\u5f02\u5e38 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new RuntimeException(\"Unable to acquire lock\"); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u8bbe\u7f6e\u9501\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u9632\u6b62\u9501\u88ab\u4e00\u76f4\u5360\u7528 &nbsp; &nbsp; &nbsp; &nbsp; redisTemplate.expire(lockKey, 10, TimeUnit.SECONDS); &nbsp; &nbsp; &nbsp; &nbsp; try { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u6267\u884c\u8ba2\u5355\u521b\u5efa\u3001\u6263\u51cf\u5e93\u5b58\u7b49\u64cd\u4f5c &nbsp; &nbsp; &nbsp; &nbsp; } finally { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u91ca\u653e\u9501 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; redisTemplate.delete(lockKey); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } }\n    \n   <\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528setIfAbsent\u65b9\u6cd5\u6765\u5c1d\u8bd5\u83b7\u53d6\u9501\uff0c\u5982\u679c\u9501\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf4\u660e\u5176\u4ed6\u7ebf\u7a0b\u6b63\u5728\u6267\u884c\u76f8\u5173\u64cd\u4f5c\uff0c\u6b64\u65f6\u4f1a\u8fd4\u56defalse\uff0c\u8868\u793a\u83b7\u53d6\u9501\u5931\u8d25\uff1b\u5426\u5219\uff0c\u4f1a\u8fd4\u56detrue\uff0c\u8868\u793a\u83b7\u53d6\u9501\u6210\u529f\u3002\u5982\u679c\u83b7\u53d6\u9501\u6210\u529f\uff0c\u6211\u4eec\u4f1a\u8bbe\u7f6e\u9501\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u5e76\u6267\u884c\u76f8\u5173\u64cd\u4f5c\uff0c\u6700\u540e\u91ca\u653e\u9501\u3002<\/p>\n<h2>\u603b\u7ed3\u63d0\u5347<\/h2>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u60b2\u89c2\u9501\u4e00\u822c\u9002\u7528\u4e8e\u5e76\u53d1\u91cf\u4e0d\u5927\u7684\u573a\u666f\uff0c\u5982\u679c\u5e76\u53d1\u91cf\u8f83\u9ad8\uff0c\u5bb9\u6613\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9700\u8981\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u9501\u7b56\u7565\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>redis\u4e50\u89c2\u9501\u4e0e\u60b2\u89c2\u9501\u7684\u5b9e\u6218&#038;&#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-201786","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201786","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=201786"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201786\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}