{"id":645,"date":"2023-12-15T18:01:01","date_gmt":"2023-12-15T10:01:01","guid":{"rendered":""},"modified":"2023-12-15T18:01:01","modified_gmt":"2023-12-15T10:01:01","slug":"Redis\u7f13\u5b58\u51fb\u7a7f\uff0c\u7f13\u5b58\u7a7f\u900f\uff0c\u7f13\u5b58\u96ea\u5d29\uff0c\u9644\u89e3\u51b3\u65b9\u6848","status":"publish","type":"post","link":"https:\/\/mushiming.com\/645.html","title":{"rendered":"Redis\u7f13\u5b58\u51fb\u7a7f\uff0c\u7f13\u5b58\u7a7f\u900f\uff0c\u7f13\u5b58\u96ea\u5d29\uff0c\u9644\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"
\u524d\u8a00<\/span><\/p>\n \u5728\u65e5\u5e38\u7684\u9879\u76ee\u4e2d\uff0c\u7f13\u5b58\u7684\u4f7f\u7528\u573a\u666f\u662f\u6bd4\u8f83\u591a\u7684\u3002\u7f13\u5b58\u662f\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u91cd\u8981\u7ec4\u4ef6\uff0c\u4e3b\u8981\u89e3\u51b3\u5728\u9ad8\u5e76\u53d1\u3001\u5927\u6570\u636e\u573a\u666f\u4e0b\uff0c\u70ed\u70b9\u6570\u636e\u8bbf\u95ee\u7684\u6027\u80fd\u95ee\u9898\uff0c\u63d0\u9ad8\u6027\u80fd\u7684\u6570\u636e\u5feb\u901f\u8bbf\u95ee\u3002\u672c\u6587\u4ee5Redis\u4f5c\u4e3a\u7f13\u5b58\u65f6\uff0c\u9488\u5bf9\u5e38\u89c1\u7684\u7f13\u5b58\u51fb\u7a7f\u3001\u7f13\u5b58\u7a7f\u900f\u3001\u7f13\u5b58\u96ea\u5d29\u95ee\u9898\u505a\u7b80\u5355\u5730\u8bf4\u660e\uff0c\u5e76\u4e14\u63d0\u4f9b\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n \n Redis\u7f13\u5b58\u4f7f\u7528\u573a\u666f<\/span><\/p>\n Redis\u4f1a\u628a\u6570\u636e\u5e93\u4e2d\u7ecf\u5e38\u88ab\u67e5\u8be2\u7684\u6570\u636e\u7f13\u5b58\u8d77\u6765\uff0c\u6bd4\u5982\u70ed\u70b9\u6570\u636e\uff0c\u8fd9\u6837\u5f53\u7528\u6237\u901a\u8fc7\u7f51\u7ad9\u6216APP\u6765\u8bbf\u95ee\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u9700\u8981\u5230\u6570\u636e\u5e93\u4e2d\u53bb\u67e5\u8be2\u4e86\uff0c\u800c\u662f\u76f4\u63a5\u83b7\u53d6 Redis\u4e2d\u7684\u7f13\u5b58\u6570\u636e\uff0c\u4ece\u800c\u964d\u4f4e\u4e86\u540e\u7aef\u6570\u636e\u5e93\u7684\u8bfb\u53d6\u538b\u529b\u3002\u5982\u679c\u8bf4\u7528\u6237\u67e5\u8be2\u7684\u6570\u636eRedis\u4e2d\u6ca1\u6709\uff0c\u6b64\u65f6\u7528\u6237\u7684\u67e5\u8be2\u8bf7\u6c42\u5c31\u4f1a\u8f6c\u5230\u6570\u636e\u5e93\uff0c\u5f53\u6570\u636e\u5e93\u5c06\u6570\u636e\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u65f6\uff0c\u540c\u65f6\u4f1a\u5c06\u6570\u636e\u7f13\u5b58\u5230 Redis\u4e2d\uff0c\u8fd9\u6837\u7528\u6237\u518d\u6b21\u8bfb\u53d6\u65f6\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u4eceRedis\u4e2d\u83b7\u53d6\u6570\u636e\u3002\u6d41\u7a0b\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n \n Redis\u7f13\u5b58\u7a7f\u900f<\/span><\/p>\n \u7f13\u5b58\u7a7f\u900f\u662f\u6307\u7528\u6237\u6076\u610f\u7684\u53d1\u8d77\u5927\u91cf\u8bf7\u6c42\u53bb\u67e5\u8be2\u4e00\u4e2a\u7f13\u5b58(Redis)\u548c\u6570\u636e\u5e93(DB)\u4e2d\u90fd\u6ca1\u6709\u7684\u6570\u636e\uff0c\u51fa\u4e8e\u5bb9\u9519\u8003\u8651\u4ece\u6570\u636e\u5e93(DB)\u67e5\u4e0d\u5230\u6570\u636e\u5219\u4e0d\u5199\u5165\u7f13\u5b58(Redis)\u8fd9\u5c06\u5bfc\u81f4\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u8981\u5230\u6570\u636e\u5e93(DB)\u4e2d\u67e5\u8be2\uff0c\u5931\u53bb\u4e86\u7f13\u5b58\u7684\u610f\u4e49\uff0c\u4ece\u800c\u5bfc\u81f4\u6570\u636e\u5e93\u56e0\u538b\u529b\u8fc7\u5927\u6302\u6389\u3002<\/p>\n \u6d41\u7a0b\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n \u89e3\u51b3\u65b9\u6848<\/span><\/p>\n \u5bf9\u7a7a\u503c\u7f13\u5b58<\/p>\n<\/li>\n<\/ol>\n \u4e0a\u9762\u6211\u4eec\u4e5f\u4ecb\u7ecd\u4e86\uff0c\u4e4b\u6240\u4ee5\u4f1a\u53d1\u751f\u7a7f\u900f\uff0c\u662f\u56e0\u4e3a\u7f13\u5b58\u4e2d\u6ca1\u6709\u5b58\u50a8\u8fd9\u4e9b\u7a7a\u6570\u636e\u7684key\uff0c\u4ece\u800c\u5bfc\u81f4\u6bcf\u6b21\u67e5\u8be2\u90fd\u5230\u6570\u636e\u5e93\u53bb\u4e86\u3002<\/p>\n \u90a3\u4e48\u6211\u4eec\u5c31\u53ef\u4ee5\u4e3a\u8fd9\u4e9bkey\u7684\u503c\u8bbe\u7f6enull\u4e22\u5230\u7f13\u5b58\u91cc\u9762\u53bb\uff0c\u540e\u9762\u518d\u51fa\u73b0\u67e5\u8be2\u8fd9\u4e2akey \u7684\u8bf7\u6c42\u7684\u65f6\u5019\uff0c\u76f4\u63a5\u8fd4\u56denull ,\u5c31\u4e0d\u7528\u5728\u5230\u6570\u636e\u5e93\u4e2d\u53bb\u8d70\u4e00\u5708\u4e86\u3002\u4f46\u662f\u522b\u5fd8\u4e86\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u3002<\/p>\n \u5173\u952e\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n \u6dfb\u52a0\u53c2\u6570\u6821\u9a8c<\/p>\n<\/li>\n<\/ol>\n \u6211\u4eec\u53ef\u4ee5\u5728\u63a5\u53e3\u5c42\u6dfb\u52a0\u6821\u9a8c\uff0c\u4e0d\u5408\u6cd5\u7684\u76f4\u63a5\u8fd4\u56de\u5373\u53ef\uff0c\u6ca1\u5fc5\u8981\u505a\u540e\u7eed\u7684\u64cd\u4f5c\u3002<\/p>\n \u4f8b\u5982\uff1a\u4f7f\u7528bitmaps\u7c7b\u578b\u5b9a\u4e49\u4e00\u4e2a\u53ef\u4ee5\u8bbf\u95ee\u540d\u5355\uff0c\u540d\u5355id\u4f5c\u4e3abitmaps\u7684\u504f\u79fb\u91cf\uff0c\u6bcf\u6b21\u8bbf\u95ee\u65f6\u4e0ebitmaps\u4e2d\u7684id\u8fdb\u884c\u6bd4\u8f83\uff0c\u5982\u679c\u8bbf\u95eeid\u4e0d\u5728bitmaps\u4e2d\uff0c\u5219\u8fdb\u884c\u62e6\u622a\uff0c\u4e0d\u7ed9\u5176\u8bbf\u95ee\u3002<\/p>\n \u91c7\u7528\u5e03\u9686\u8fc7\u6ee4\u5668<\/p>\n<\/li>\n<\/ol>\n \u5e03\u9686\u8fc7\u6ee4\u5668\uff08Bloom Filter\uff09\uff0cBloom Filter \u7c7b\u4f3c\u4e8e\u4e00\u4e2ahash set \u7528\u6765\u5224\u65ad\u67d0\u4e2a\u5143\u7d20\uff08key\uff09\u662f\u5426\u5b58\u5728\u4e8e\u67d0\u4e2a\u96c6\u5408\u4e2d\uff0c\u4e0d\u5b58\u5728return\u5c31\u597d\u4e86\uff0c\u5b58\u5728\u5c31\u53bb\u67e5DB\u5237\u65b0\u7f13\u5b58KV\u518dreturn\uff0c\u5b83\u7684\u4f18\u70b9\u662f\u7a7a\u95f4\u6548\u7387\u548c\u67e5\u8be2\u65f6\u95f4\u90fd\u6bd4\u4e00\u822c\u7b97\u6cd5\u5feb\uff0c\u7f3a\u70b9\u662f\u6709\u4e00\u5b9a\u7684\u8bef\u8bc6\u522b\u7387\u548c\u5220\u9664\u56f0\u96be\u3002<\/p>\n \u5e03\u9686\u8fc7\u6ee4\u5668\u7684\u5de5\u4f5c\u65b9\u5f0f:<\/p>\n \u4e00\u4e2a\u7a7a\u7684\u5e03\u9686\u8fc7\u6ee4\u5668\u662f\u4e00\u4e2a\u7531m\u4e2a\u4e8c\u8fdb\u5236\u4f4d\u6784\u6210\u7684\u6570\u7ec4\u3002<\/p>\n \u4ee5\u4e0a\u53ea\u662f\u753b\u4e86\u5e03\u9686\u8fc7\u6ee4\u5668\u7684\u5f88\u5c0f\u5f88\u5c0f\u7684\u4e00\u90e8\u5206\uff0c\u5b9e\u9645\u5e03\u9686\u8fc7\u6ee4\u5668\u662f\u975e\u5e38\u5927\u7684\u6570\u7ec4\uff08\u8fd9\u91cc\u7684\u5927\u662f\u6307\u5b83\u7684\u957f\u5ea6\u5927\uff0c\u5e76\u4e0d\u662f\u6307\u5b83\u6240\u5360\u7684\u5185\u5b58\u7a7a\u95f4\u5927\uff09\u3002<\/p>\n \u5f53\u4e00\u4e2a\u6570\u636e\u8fdb\u884c\u5b58\u5165\u5e03\u9686\u8fc7\u6ee4\u5668\u7684\u65f6\u5019\uff0c\u4f1a\u7ecf\u8fc7\u82e5\u5e72\u4e2a\u54c8\u5e0c\u51fd\u6570\u8fdb\u884c\u54c8\u5e0c\uff0c\u5f97\u5230\u5bf9\u5e94\u7684\u54c8\u5e0c\u503c\u4f5c\u4e3a\u6570\u7ec4\u7684\u4e0b\u6807\uff0c\u7136\u540e\u5c06\u521d\u59cb\u5316\u7684\u4f4d\u6570\u7ec4\u5bf9\u5e94\u7684\u4e0b\u6807\u7684\u503c\u4fee\u6539\u4e3a1\uff0c\u7ed3\u679c\u56fe\u5982\u4e0b\uff1a<\/p>\n \u5f53\u518d\u6b21\u8fdb\u884c\u5b58\u5165\u7b2c\u4e8c\u4e2a\u503c\u7684\u65f6\u5019\uff0c\u4fee\u6539\u540e\u7684\u7ed3\u679c\u7684\u539f\u7406\u56fe\u5982\u4e0b\uff1a<\/p>\n \u90a3\u4e48\u4e3a\u4ec0\u4e48\u4f1a\u6709\u8bef\u5224\u7387\u5462\uff1f<\/p>\n \u5047\u8bbe\u5728\u6211\u4eec\u591a\u6b21\u5b58\u5165\u503c\u540e\uff0c\u5728\u5e03\u9686\u8fc7\u6ee4\u5668\u4e2d\u5b58\u5728x\u3001y\u3001z\u8fd9\u4e09\u4e2a\u503c\uff0c\u5e03\u9686\u8fc7\u6ee4\u5668\u7684\u5b58\u50a8\u7ed3\u6784\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n \u5f53\u6211\u4eec\u8981\u67e5\u8be2\u7684\u65f6\u5019\uff0c\u6bd4\u5982\u67e5\u8be2M\u8fd9\u4e2a\u6570\uff0c\u5b9e\u9645\u4e2dM\u8fd9\u4e2a\u6570\u662f\u4e0d\u5b58\u5728\u5e03\u9686\u8fc7\u6ee4\u5668\u4e2d\u7684\uff0c\u7ecf\u8fc7\u54c8\u5e0c\u51fd\u6570\u8ba1\u7b97\u540e\u5f97\u5230M\u7684\u54c8\u5e0c\u503c\u5206\u522b\u4e3a1\u548c7\uff0c\u7ed3\u6784\u539f\u7406\u56fe\u5982\u4e0b\uff1a<\/p>\n \u7ecf\u8fc7\u67e5\u8be2\u540e\uff0c\u53d1\u73b01\u548c7\u4f4d\u7f6e\u6240\u5b58\u50a8\u7684\u503c\u90fd\u4e3a1\uff0c\u4f46\u662f1\u548c7\u7684\u4e0b\u6807\u5206\u522b\u662fX\u548cZ\u7ecf\u8fc7\u8ba1\u7b97\u540e\u7684\u4e0b\u6807\u4f4d\u7f6e\u7684\u4fee\u6539\uff0c\u8be5\u5e03\u9686\u8fc7\u6ee4\u5668\u4e2d\u5b9e\u9645\u4e0d\u5b58\u5728M\uff0c\u90a3\u4e48\u5e03\u9686\u8fc7\u6ee4\u5668\u5c31\u4f1a\u8bef\u5224\u6539\u503c\u53ef\u80fd\u5b58\u5728\uff0c\u56e0\u4e3a\u5e03\u9686\u8fc7\u6ee4\u5668\u4e0d\u5b58\u5143\u7d20\u503c\uff0c\u6240\u4ee5\u5b58\u5728\u8bef\u5224\u7387\u3002<\/p>\n \u90a3\u4e48\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u5220\u9664\u5143\u7d20\u5462\uff1f<\/p>\n \u539f\u56e0\u5f88\u7b80\u5355\uff0c\u56e0\u4e3a\u5220\u9664\u5143\u7d20\u540e\uff0c\u5c06\u5bf9\u5e94\u5143\u7d20\u7684\u4e0b\u6807\u8bbe\u7f6e\u4e3a\u96f6\uff0c\u53ef\u80fd\u522b\u7684\u5143\u7d20\u7684\u4e0b\u6807\u4e5f\u5f15\u7528\u6539\u4e0b\u6807\uff0c\u8fd9\u6837\u522b\u7684\u5143\u7d20\u7684\u5224\u65ad\u5c31\u4f1a\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n \n Redis\u7f13\u5b58\u96ea\u5d29<\/span><\/p>\n \u7f13\u5b58\u96ea\u5d29\u662f\u6307\u5927\u91cf\u7684\u5e94\u7528\u8bf7\u6c42\u65e0\u6cd5\u5728Redis\u7f13\u5b58\u4e2d\u8fdb\u884c\u5904\u7406\uff0c\u7d27\u63a5\u7740\u5e94\u7528\u5c06\u5927\u91cf\u8bf7\u6c42\u53d1\u9001\u5230\u6570\u636e\u5e93\u5c42\uff0c\u5bfc\u81f4\u6570\u636e\u5e93\u5c42\u7684\u538b\u529b\u6fc0\u589e\u3002<\/p>\n \u7f13\u5b58\u96ea\u5d29\u4e00\u822c\u662f\u7531\u4e24\u4e2a\u539f\u56e0\u5bfc\u81f4\u7684\uff0c\u5e94\u5bf9\u65b9\u6848\u4e5f\u6709\u6240\u4e0d\u540c\u3002\u7b2c\u4e00\u4e2a\u539f\u56e0\u662f\uff1a\u7f13\u5b58\u4e2d\u6709\u5927\u91cf\u6570\u636e\u540c\u65f6\u8fc7\u671f\uff0c\u5bfc\u81f4\u5927\u91cf\u8bf7\u6c42\u65e0\u6cd5\u5f97\u5230\u5904\u7406\u3002\u7b2c\u4e8c\u4e2a\u539f\u56e0\u662f\uff1aRedis \u7f13\u5b58\u5b9e\u4f8b\u53d1\u751f\u6545\u969c\u5b95\u673a\u4e86\uff0c\u65e0\u6cd5\u5904\u7406\u8bf7\u6c42\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u5927\u91cf\u8bf7\u6c42\u4e00\u4e0b\u5b50\u79ef\u538b\u5230\u6570\u636e\u5e93\u5c42\uff0c\u4ece\u800c\u53d1\u751f\u7f13\u5b58\u96ea\u5d29\u3002<\/p>\n \u6d41\u7a0b\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n \u89e3\u51b3\u65b9\u6848<\/span><\/p>\n \u5927\u91cf\u70ed\u70b9\u6570\u636e\u540c\u65f6\u5931\u6548\u5e26\u6765\u7684\u7f13\u5b58\u96ea\u5d29\u95ee\u9898<\/p>\n<\/li>\n<\/ol>\n \u4f7f\u7528 EXPIRE\u547d\u4ee4\u7ed9\u6bcf\u4e2a\u6570\u636e\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u65f6\uff0c\u7ed9\u8fd9\u4e9b\u6570\u636e\u7684\u8fc7\u671f\u65f6\u95f4\u589e\u52a0\u4e00\u4e2a\u8f83\u5c0f\u7684\u968f\u673a\u6570\uff08\u4f8b\u5982\uff0c\u968f\u673a\u589e\u52a0 1~3 \u5206\u949f\uff09\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u4e0d\u540c\u6570\u636e\u7684\u8fc7\u671f\u65f6\u95f4\u6709\u6240\u5dee\u522b\uff0c\u4f46\u5dee\u522b\u53c8\u4e0d\u4f1a\u592a\u5927\u3002\u65e2\u907f\u514d\u4e86\u5927\u91cf\u6570\u636e\u540c\u65f6\u8fc7\u671f\uff0c\u540c\u65f6\u4e5f\u4fdd\u8bc1\u4e86\u8fd9\u4e9b\u6570\u636e\u57fa\u672c\u5728\u76f8\u8fd1\u7684\u65f6\u95f4\u5931\u6548\uff0c\u4ecd\u7136\u80fd\u6ee1\u8db3\u4e1a\u52a1\u9700\u6c42\u3002<\/p>\n 2. \u670d\u52a1\u964d\u7ea7<\/p>\n \u6240\u8c13\u7684\u670d\u52a1\u964d\u7ea7\uff0c\u662f\u6307\u53d1\u751f\u7f13\u5b58\u96ea\u5d29\u65f6\uff0c\u9488\u5bf9\u4e0d\u540c\u7684\u6570\u636e\u91c7\u53d6\u4e0d\u540c\u7684\u5904\u7406\u65b9\u5f0f\uff0c\u4f8b\u5982\uff1a<\/p>\n \u5f53\u4e1a\u52a1\u5e94\u7528\u8bbf\u95ee\u7684\u662f\u975e\u6838\u5fc3\u6570\u636e\u65f6\uff0c\u6682\u65f6\u505c\u6b62\u4ece\u7f13\u5b58\u4e2d\u67e5\u8be2\u8fd9\u4e9b\u6570\u636e\uff0c\u800c\u662f\u76f4\u63a5\u8fd4\u56de\u9884\u5b9a\u4e49\u4fe1\u606f\u3001\u7a7a\u503c\u6216\u662f\u9519\u8bef\u4fe1\u606f\uff1b<\/p>\n<\/li>\n<\/ul>\n \u5f53\u4e1a\u52a1\u5e94\u7528\u8bbf\u95ee\u7684\u662f\u6838\u5fc3\u6570\u636e\u65f6\uff0c\u4ecd\u7136\u5141\u8bb8\u67e5\u8be2\u7f13\u5b58\uff0c\u5982\u679c\u7f13\u5b58\u7f3a\u5931\uff0c\u4e5f\u53ef\u4ee5\u7ee7\u7eed\u901a\u8fc7\u6570\u636e\u5e93\u8bfb\u53d6\u3002<\/p>\n<\/li>\n<\/ul>\n \u8fd9\u6837\u4e00\u6765\uff0c\u6211\u4eec\u5c31\u907f\u514d\u4e86\u5927\u91cf\u8bf7\u6c42\u56e0\u7f13\u5b58\u7f3a\u5931\uff0c\u800c\u79ef\u538b\u5230\u6570\u636e\u5e93\u7cfb\u7edf\uff0c\u4fdd\u8bc1\u4e86\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n 3. Redis \u7f13\u5b58\u5b9e\u4f8b\u53d1\u751f\u6545\u969c\u5b95\u673a\u5e26\u6765\u7684\u7f13\u5b58\u96ea\u5d29\u95ee\u9898<\/p>\n \u4ece\u4e8b\u524d\u9884\u9632\u7684\u89d2\u5ea6\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e3b\u4ece\u8282\u70b9\u7684\u65b9\u5f0f\u6784\u5efa Redis \u7f13\u5b58\u9ad8\u53ef\u9760\u96c6\u7fa4\u3002\u5982\u679c Redis\u7f13\u5b58\u7684\u4e3b\u8282\u70b9\u6545\u969c\u5b95\u673a\u4e86\uff0c\u4ece\u8282\u70b9\u8fd8\u53ef\u4ee5\u5207\u6362\u6210\u4e3a\u4e3b\u8282\u70b9\uff0c\u7ee7\u7eed\u63d0\u4f9b\u7f13\u5b58\u670d\u52a1\uff0c\u907f\u514d\u4e86\u7531\u4e8e\u7f13\u5b58\u5b9e\u4f8b\u5b95\u673a\u800c\u5bfc\u81f4\u7684\u7f13\u5b58\u96ea\u5d29\u95ee\u9898\u3002<\/p>\n \u5982\u679c\u5b9e\u9645\u4e1a\u52a1\u7cfb\u7edf\u771f\u53d1\u751f\u4e86Redis \u7f13\u5b58\u5b9e\u4f8b\u4e0d\u53ef\u7528\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4e1a\u52a1\u7cfb\u7edf\u4e2d\u5b9e\u73b0\u670d\u52a1\u7194\u65ad\u6216\u8bf7\u6c42\u9650\u6d41\u673a\u5236\u3002\u6240\u8c13\u7684\u670d\u52a1\u7194\u65ad\uff0c\u662f\u6307\u5728\u53d1\u751f\u7f13\u5b58\u96ea\u5d29\u65f6\uff0c\u4e3a\u4e86\u9632\u6b62\u5f15\u53d1\u8fde\u9501\u7684\u6570\u636e\u5e93\u96ea\u5d29\uff0c\u751a\u81f3\u662f\u6574\u4e2a\u7cfb\u7edf\u7684\u5d29\u6e83\uff0c\u6211\u4eec\u6682\u505c\u4e1a\u52a1\u5e94\u7528\u5bf9\u7f13\u5b58\u7cfb\u7edf\u7684\u63a5\u53e3\u8bbf\u95ee\u3002<\/p>\n \n Redis\u7f13\u5b58\u51fb\u7a7f<\/span><\/p>\n \u6211\u4eec\u5728\u5e73\u5e38\u9ad8\u5e76\u53d1\u7684\u7cfb\u7edf\u4e2d\uff0c\u5927\u91cf\u7684\u8bf7\u6c42\u540c\u65f6\u67e5\u8be2\u4e00\u4e2akey\u65f6\uff0c\u5047\u8bbe\u6b64\u65f6\u8fd9\u4e2akey\u6b63\u597d\u5931\u6548\u4e86\uff0c\u5c31\u4f1a\u5bfc\u81f4\u5927\u91cf\u7684\u8bf7\u6c42\u90fd\u6253\u5230\u6570\u636e\u5e93\u4e0a\u9762\u53bb\uff0c\u8fd9\u79cd\u73b0\u8c61\u6211\u4eec\u79f0\u4e3a\u51fb\u7a7f\u3002<\/p>\n \u8fd9\u4e48\u770b\u7f13\u5b58\u51fb\u7a7f\u548c\u7f13\u5b58\u96ea\u5d29\u6709\u70b9\u50cf\uff0c\u4f46\u662f\u53c8\u6709\u4e00\u70b9\u4e0d\u4e00\u6837\uff0c\u7f13\u5b58\u96ea\u5d29\u662f\u56e0\u4e3a\u5927\u9762\u79ef\u7684\u7f13\u5b58\u5931\u6548\uff0c\u6253\u5d29\u4e86DB\uff0c\u800c\u7f13\u5b58\u51fb\u7a7f\u4e0d\u540c\u7684\u662f\u300c\u7f13\u5b58\u51fb\u7a7f\u300d\u662f\u6307\u4e00\u4e2aKey\u975e\u5e38\u70ed\u70b9\uff0c\u5728\u4e0d\u505c\u7684\u625b\u7740\u5927\u5e76\u53d1\uff0c\u5927\u5e76\u53d1\u96c6\u4e2d\u5bf9\u8fd9\u4e00\u4e2a\u70b9\u8fdb\u884c\u8bbf\u95ee\uff0c\u5f53\u8fd9\u4e2aKey\u5728\u5931\u6548\u7684\u77ac\u95f4\uff0c\u6301\u7eed\u7684\u5927\u5e76\u53d1\u5c31\u7a7f\u7834\u7f13\u5b58\uff0c\u76f4\u63a5\u8bf7\u6c42\u6570\u636e\u5e93\uff0c\u5c31\u50cf\u5728\u4e00\u4e2a\u5b8c\u597d\u65e0\u635f\u7684\u6876\u4e0a\u51ff\u5f00\u4e86\u4e00\u4e2a\u6d1e\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n \u89e3\u51b3\u65b9\u6848<\/span><\/p>\n 1. \u70edkey\u4e0d\u8fc7\u671f<\/p>\n \u9884\u5148\u8bbe\u7f6e\u70ed\u95e8\u6570\u636e\uff1a\u5728Redis\u9ad8\u5cf0\u8bbf\u95ee\u65f6\u671f\uff0c\u63d0\u524d\u8bbe\u7f6e\u70ed\u95e8\u6570\u636e\u5230\u7f13\u5b58\u4e2d\uff0c\u5bf9\u8fd9\u4e9b\u70edkey\u4e0d\u8bbe\u7f6e\u5931\u6548\u65f6\u95f4\uff0c\u4e0d\u8fc7\u8fd9\u6837\u8bbe\u7f6e\u9700\u8981\u533a\u5206\u573a\u666f\u3002<\/p>\n<\/li>\n<\/ul>\n \u5b9e\u65f6\u8c03\u6574\uff1a\u5b9e\u65f6\u76d1\u63a7\u54ea\u4e9b\u6570\u636e\u70ed\u95e8\uff0c\u5b9e\u65f6\u8c03\u6574key\u8fc7\u671f\u65f6\u95f4\u3002<\/p>\n<\/li>\n<\/ul>\n 2. \u5206\u5e03\u5f0f\u9501<\/p>\n \u4e3a\u4e86\u907f\u514d\u51fa\u73b0\u7f13\u5b58\u51fb\u7a7f\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u7b2c\u4e00\u4e2a\u8bf7\u6c42\u53bb\u67e5\u8be2\u6570\u636e\u5e93\u7684\u65f6\u5019\u5bf9\u4ed6\u52a0\u4e00\u4e2a\u5206\u5e03\u5f0f\u9501\uff0c\u5176\u4f59\u7684\u67e5\u8be2\u8bf7\u6c42\u90fd\u4f1a\u88ab\u963b\u585e\u4f4f\uff0c\u76f4\u5230\u9501\u88ab\u91ca\u653e\uff0c\u540e\u9762\u7684\u7ebf\u7a0b\u8fdb\u6765\u53d1\u73b0\u5df2\u7ecf\u6709\u7f13\u5b58\u4e86\uff0c\u5c31\u76f4\u63a5\u8d70\u7f13\u5b58\uff0c\u4ece\u800c\u4fdd\u62a4\u6570\u636e\u5e93\u3002\u4f46\u662f\u4e5f\u662f\u7531\u4e8e\u5b83\u4f1a\u963b\u585e\u5176\u4ed6\u7684\u7ebf\u7a0b\uff0c\u6b64\u65f6\u7cfb\u7edf\u541e\u5410\u91cf\u4f1a\u4e0b\u964d\u3002\u9700\u8981\u7ed3\u5408\u5b9e\u9645\u7684\u4e1a\u52a1\u53bb\u8003\u8651\u662f\u5426\u8981\u8fd9\u4e48\u505a\u3002<\/p>\n \u5173\u952e\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n \u603b\u7ed3<\/span><\/p>\n \n \u7f13\u5b58\u51fb\u7a7f<\/span><\/p>\n key\u5bf9\u5e94\u7684\u6570\u636e\u5b58\u5728\uff0c\u4f46\u5728redis\u4e2d\u8fc7\u671f\uff0c\u6b64\u65f6\u82e5\u6709\u5927\u91cf\u5e76\u53d1\u8bf7\u6c42\u8fc7\u6765\uff0c\u8fd9\u4e9b\u8bf7\u6c42\u53d1\u73b0\u7f13\u5b58\u8fc7\u671f\u4e00\u822c\u90fd\u4f1a\u4ece\u540e\u7aefDB\u52a0\u8f7d\u6570\u636e\u5e76\u56de\u8bbe\u5230\u7f13\u5b58\uff0c\u8fd9\u4e2a\u65f6\u5019\u5927\u5e76\u53d1\u7684\u8bf7\u6c42\u53ef\u80fd\u4f1a\u77ac\u95f4\u628a\u540e\u7aefDB\u538b\u57ae\u3002\u4e00\u822c\u901a\u8fc7\u4e92\u65a5\u9501\uff0c\u70ed\u70b9\u6570\u636e\u6c38\u4e0d\u8fc7\u671f\uff0c\u5b9a\u65f6\u5237\u65b0\u8fc7\u671f\u65f6\u95f4\u7b49\u65b9\u6cd5\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n \n \u7f13\u5b58\u7a7f\u900f<\/span><\/p>\n key\u5bf9\u5e94\u7684\u6570\u636e\u5728\u6570\u636e\u6e90\u5e76\u4e0d\u5b58\u5728\uff0c\u6bcf\u6b21\u9488\u5bf9\u6b64key\u7684\u8bf7\u6c42\u4ece\u7f13\u5b58\u83b7\u53d6\u4e0d\u5230\uff0c\u8bf7\u6c42\u90fd\u4f1a\u5230\u6570\u636e\u6e90\uff0c\u4ece\u800c\u53ef\u80fd\u538b\u57ae\u6570\u636e\u6e90\u3002\u6bd4\u5982\u7528\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u7528\u6237id\u83b7\u53d6\u7528\u6237\u4fe1\u606f\uff0c\u4e0d\u8bba\u7f13\u5b58\u8fd8\u662f\u6570\u636e\u5e93\u90fd\u6ca1\u6709\uff0c\u82e5\u9ed1\u5ba2\u5229\u7528\u6b64\u6f0f\u6d1e\u8fdb\u884c\u653b\u51fb\u53ef\u80fd\u538b\u57ae\u6570\u636e\u5e93\u3002\u4e00\u822c\u901a\u8fc7\u5bf9\u7a7a\u6570\u636e\u8fdb\u884c\u7f13\u5b58\uff0c\u5e03\u9686\u8fc7\u6ee4\u5668\u7b49\u65b9\u6cd5\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n \n \u7f13\u5b58\u96ea\u5d29<\/span><\/p>\n \u5f53\u7f13\u5b58\u670d\u52a1\u5668\u91cd\u542f\u6216\u8005\u5927\u91cf\u7f13\u5b58\u96c6\u4e2d\u5728\u67d0\u4e00\u4e2a\u65f6\u95f4\u6bb5\u5931\u6548\uff0c\u8fd9\u6837\u5728\u5931\u6548\u7684\u65f6\u5019\uff0c\u4e5f\u4f1a\u7ed9\u540e\u7aef\u7cfb\u7edf(\u6bd4\u5982DB)\u5e26\u6765\u5f88\u5927\u538b\u529b\u3002\u4e00\u822c\u901a\u8fc7\u52a0\u9501\u6392\u961f\uff0c\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u968f\u673a\u503c\u7b49\u65b9\u6cd5\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Redis\u7f13\u5b58\u51fb\u7a7f\uff0c\u7f13\u5b58\u7a7f\u900f\uff0c\u7f13\u5b58\u96ea\u5d29\uff0c\u9644\u89e3\u51b3\u65b9\u6848\u524d\u8a00\u5728\u65e5\u5e38\u7684\u9879\u76ee\u4e2d\uff0c\u7f13\u5b58\u7684\u4f7f\u7528\u573a\u666f\u662f\u6bd4\u8f83\u591a\u7684\u3002\u7f13\u5b58\u662f\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u91cd\u8981\u7ec4...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/645"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
\n
\n
\n
\u907f\u514d\u70edkey\u540c\u65f6\u5931\u6548<\/h4>\n
\n
\n
\n
\n