{"id":90375,"date":"2022-05-05T20:14:25","date_gmt":"2022-05-05T12:14:25","guid":{"rendered":"http:\/\/www.idc.net\/help\/90375\/"},"modified":"2022-05-05T20:14:25","modified_gmt":"2022-05-05T12:14:25","slug":"%e6%b8%85%e9%99%a4redis%ef%bc%8c%e9%87%8a%e6%94%be%e7%a9%ba%e9%97%b4%ef%bc%88%e5%88%a0%e9%99%a4redis%e4%b8%ad%e6%95%b0%e6%8d%ae%ef%bc%89","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/90375\/","title":{"rendered":"\u6e05\u9664Redis\uff0c\u91ca\u653e\u7a7a\u95f4\uff08\u5220\u9664redis\u4e2d\u6570\u636e\uff09"},"content":{"rendered":"<p>Redis\u5168\u79f0\u4e3aRemote Dictionary Server\uff0c\u662f\u4e00\u79cd\u975e\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff0c\u8fd0\u884c\u5728\u5185\u5b58\u4e2d\uff0c\u7528\u4e8e\u5b58\u50a8\u9ad8\u901f key-value \u6570\u636e\u3002\u968f\u7740\u4e1a\u52a1\u7684\u4e0d\u65ad\u589e\u957f\uff0cRedis\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u91cf\u4e5f\u8d8a\u6765\u8d8a\u5927\uff0c\u4ece\u800c\u5360\u7528\u4e86\u5f88\u591a\u7cfb\u7edf\u5185\u5b58\uff0c\u5f71\u54cd\u4e86\u670d\u52a1\u7684\u6027\u80fd\u3002\u968f\u4e4b\u800c\u6765\u7684\u5c31\u662f\u5bf9Redis\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u6e05\u6d17\uff0c\u91ca\u653e\u7a7a\u95f4\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<p>\u6e05\u7406Redis\uff0c\u91ca\u653e\u7a7a\u95f4\u7684\u6b65\u9aa4\u662f\uff1a<\/p>\n<\/p>\n<p>1. \u6e05\u7406\u5931\u6548\/\u8fc7\u671f\u6570\u636e<\/p>\n<\/p>\n<p>\u7f13\u5b58\u7cfb\u7edf\u4e2d\u5b58\u50a8\u7684\u5f88\u591a\u6570\u636e\u90fd\u6709\u4e00\u4e2a\u6709\u6548\u671f\uff0c\u4e00\u4e2a\u8fc7\u671f\u65f6\u95f4\u3002\u8fc7\u671f\u7684\u6570\u636e\u4e0d\u518d\u6709\u4efb\u4f55\u610f\u4e49\uff0c\u9700\u8981\u5b9a\u671f\u6e05\u7406\u6389\u8fc7\u671f\u7684\u6570\u636e\uff0c\u91ca\u653e\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n<\/p>\n<p>\u4f8b\u5982\uff0c\u4f7f\u7528\u4ee5\u4e0b\u7684del\u547d\u4ee4\u53ef\u4ee5\u5220\u9664Redis\u6307\u5b9a\u7684key-value\u6570\u636e\uff1a<\/p>\n<\/p>\n<p>127.0.0.1:6379&gt; del key<\/p>\n<\/p>\n<p>2. \u6e05\u7406\u4e0d\u518d\u4f7f\u7528\u7684\u6570\u636e<\/p>\n<\/p>\n<p>returns<\/p>\n<\/p>\n<p>\u4e00\u4e9bRedis\u4e2d\u7684key-value\u6570\u636e\u53ef\u80fd\u4e0d\u518d\u4f7f\u7528\uff0c\u800c\u8fd9\u4e9b\u6570\u636e\u5374\u4e00\u76f4\u5360\u7740\u5185\u5b58\u4f4d\u7f6e\uff0c\u5360\u7528\u7684\u7a7a\u95f4\u4e5f\u5f88\u5927\uff0c\u9700\u8981\u5b9a\u671f\u6e05\u7406\u6389\u4ed6\u4eec\uff0c\u91ca\u653e\u7a7a\u95f4\u3002<\/p>\n<\/p>\n<p>\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6e05\u7406Redis\u4e2d\u4e0d\u518d\u4f7f\u7528\u7684\u6570\u636e\uff1a<\/p>\n<\/p>\n<p>127.0.0.1:6379&gt; flushdb<\/p>\n<\/p>\n<p>3. \u4f7f\u7528LRU\u7b97\u6cd5\u91ca\u653e\u7a7a\u95f4<\/p>\n<\/p>\n<p>returns<\/p>\n<\/p>\n<p>Redis\u4f7f\u7528LRU\u7b97\u6cd5\uff08Least Frequently Used\uff09\u6765\u91ca\u653e\u7a7a\u95f4\uff0c\u8be5\u7b97\u6cd5\u4f1a\u5728\u4e00\u5b9a\u7684\u65f6\u95f4\u5185\uff08\u6bd4\u59821\u5206\u949f\uff09\u81ea\u52a8\u91ca\u653e\u5185\u5b58\u4e2d\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\u7684key-value\u6570\u636e\uff0c\u91ca\u653e\u51fa\u7a7a\u95f4\u3002<\/p>\n<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5f00\u542fLRU\u7b97\u6cd5<\/p>\n<\/p>\n<p>127.0.0.1:6379&gt; config set maxmemory-policy allkeys-lru<\/p>\n<\/p>\n<p>\u56e0\u6b64\uff0c\u4e3a\u4e86\u91ca\u653e\u7cfb\u7edf\u5185\u5b58\u7a7a\u95f4\uff0c\u63d0\u5347Redis\u670d\u52a1\u6027\u80fd\uff0c\u53ef\u4ee5\u5b9a\u671f\u6267\u884c\u4ee5\u4e0a\u4e09\u79cd\u64cd\u4f5c\uff0c\u5bf9Redis\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u6e05\u7406\uff0c\u91ca\u653e\u7a7a\u95f4\u3002<\/p>\n<p><a href=\"http:https:\/\/idc.net\/\">\u9999\u6e2f\u670d\u52a1\u5668<\/a>\u9996\u9009\u540e\u6d6a\u4e91\uff0c2H2G\u9996\u670810\u5143\u5f00\u901a\u3002<br \/>\u540e\u6d6a\u4e91\uff08www.IDC.Net\uff09\u63d0\u4f9b\u7b80\u5355\u597d\u7528\uff0c\u4ef7\u683c\u539a\u9053\u7684\u9999\u6e2f\/\u7f8e\u56fd\u4e91\u670d\u52a1\u5668\u548c\u72ec\u7acb\u670d\u52a1\u5668\u3002IDC+ISP+ICP\u8d44\u8d28\u3002ARIN\u548cAPNIC\u4f1a\u5458\u3002\u6210\u719f\u6280\u672f\u56e2\u961f15\u5e74\u884c\u4e1a\u7ecf\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redis\u5168\u79f0\u4e3aRemote Dictionary Server\uff0c\u662f\u4e00\u79cd\u975e\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff0c\u8fd0\u884c\u5728\u5185\u5b58\u4e2d\uff0c\u7528\u4e8e\u5b58\u50a8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7038],"tags":[],"class_list":["post-90375","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/90375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=90375"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/90375\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=90375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=90375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=90375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}