{"id":123994,"date":"2026-11-08T16:32:56","date_gmt":"2026-11-08T08:32:56","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/123994.html"},"modified":"2026-11-08T16:32:56","modified_gmt":"2026-11-08T08:32:56","slug":"%e9%94%ae%e5%88%b0%e6%9c%9f%e4%ba%86%e4%b8%ba%e4%bb%80%e4%b9%88%e8%bf%98%e5%8d%a0%e5%86%85%e5%ad%98%ef%bc%9fredis%e7%9a%84%e8%bf%87%e6%9c%9f%e5%88%a0%e9%99%a4%e4%b8%8e8%e7%a7%8d%e5%86%85%e5%ad%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/123994.html","title":{"rendered":"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<p>\u8fd0\u7ef4\u6216\u6d4b\u8bd5 Redis \u65f6&#xff0c;\u5e38\u4f1a\u9047\u5230\u4e24\u4e2a\u53cd\u76f4\u89c9\u73b0\u8c61&#xff1a;\u7ed9\u5927\u91cf\u952e\u8bbe\u7f6e\u4e86 TTL&#xff0c;\u65f6\u949f\u65e9\u5df2\u8d8a\u8fc7\u5230\u671f\u70b9&#xff0c;\u76d1\u63a7\u4e2d\u7684\u5185\u5b58\u5360\u7528\u5374\u7eb9\u4e1d\u4e0d\u52a8&#xff1b;\u800c\u5728\u53e6\u4e00\u6279\u952e\u4e0a\u660e\u660e\u914d\u7f6e\u4e86 24 \u5c0f\u65f6\u751f\u5b58\u671f&#xff0c;\u521a\u5b58\u5165\u4e24\u5c0f\u65f6&#xff0c;\u6570\u636e\u5374\u63d0\u524d\u6d88\u5931\u4e86\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u73b0\u8c61\u80cc\u540e&#xff0c;\u662f\u4e24\u6761\u6b63\u4ea4\u7684\u5185\u6838\u673a\u5236&#xff1a;\u8fc7\u671f\u5220\u9664&#xff08;Expiration Deletion&#xff09;\u4e0e\u5185\u5b58\u6dd8\u6c70&#xff08;Memory Eviction&#xff09;\u3002<\/p>\n<p>\u524d\u8005\u7531\u6570\u636e\u65f6\u6548\u9a71\u52a8&#xff0c;\u5904\u7406\u903b\u8f91\u5230\u671f\u4e0e\u7269\u7406\u56de\u6536\u7684\u8282\u594f&#xff1b;\u540e\u8005\u7531\u5bb9\u91cf\u9884\u7b97\u9a71\u52a8&#xff0c;\u5904\u7406\u5185\u5b58\u903c\u8fd1\u4e0a\u9650\u65f6\u7684\u7a7a\u95f4\u817e\u632a\u3002TTL \u53ea\u662f\u751f\u547d\u5468\u671f\u9884\u671f&#xff0c;\u5e76\u4e0d\u4fdd\u8bc1\u6570\u636e\u4e0d\u4f1a\u56e0\u5185\u5b58\u6dd8\u6c70\u63d0\u524d\u9a71\u9010&#xff1b;\u800c\u952e\u5230\u671f\u4e5f\u53ea\u4ee3\u8868\u903b\u8f91\u5931\u6548&#xff0c;\u7269\u7406\u5185\u5b58\u7edd\u975e\u5230\u671f\u77ac\u95f4\u5373\u523b\u91ca\u653e\u3002<\/p>\n<hr \/>\n<h3>\u5efa\u7acb\u57fa\u51c6&#xff1a;\u56db\u6761\u4e0d\u540c\u5c5e\u6027\u7684\u7f13\u5b58 Key<\/h3>\n<p>\u5728\u6570\u636e\u5e93\u4e2d\u653e\u7f6e\u56db\u6761\u5177\u8c61\u4e1a\u52a1\u952e\u4f5c\u4e3a\u63a8\u5bfc\u57fa\u51c6&#xff1a;<\/p>\n<table>\n<tr>\u952e\u540d&#xff08;Key&#xff09;\u751f\u5b58\u65f6\u6548&#xff08;TTL&#xff09;\u8bbf\u95ee\u7279\u5f81\u767b\u8bb0\u5b57\u5178<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">session:token:901<\/td>\n<td align=\"left\">\u5269\u4f59 5 \u79d2\u5230\u671f<\/td>\n<td align=\"left\">\u8ddd\u4e0a\u6b21\u8bbf\u95ee\u8f83\u4e45&#xff0c;\u5386\u53f2\u9891\u6b21\u8f83\u4f4e<\/td>\n<td align=\"left\">db-&gt;dict \u4e0e db-&gt;expires<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">cache:order:1024<\/td>\n<td align=\"left\">\u5269\u4f59 3600 \u79d2\u5230\u671f<\/td>\n<td align=\"left\">\u6700\u8fd1\u521a\u88ab\u8bbf\u95ee&#xff0c;\u5386\u53f2\u9891\u6b21\u8f83\u9ad8<\/td>\n<td align=\"left\">db-&gt;dict \u4e0e db-&gt;expires<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">config:whitelist<\/td>\n<td align=\"left\">\u672a\u8bbe TTL&#xff08;\u6301\u4e45\u952e&#xff09;<\/td>\n<td align=\"left\">\u8ddd\u4e0a\u6b21\u8bbf\u95ee\u8f83\u4e45&#xff0c;\u5386\u53f2\u9891\u6b21\u8f83\u4f4e<\/td>\n<td align=\"left\">\u4ec5 db-&gt;dict<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">counter:active_uv<\/td>\n<td align=\"left\">\u672a\u8bbe TTL&#xff08;\u6301\u4e45\u952e&#xff09;<\/td>\n<td align=\"left\">\u6700\u8fd1\u521a\u88ab\u8bbf\u95ee&#xff0c;\u5386\u53f2\u9891\u6b21\u8f83\u9ad8<\/td>\n<td align=\"left\">\u4ec5 db-&gt;dict<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u5185\u6838\u7ed3\u6784\u4f53 redisDb \u4e2d&#xff0c;\u8fd9\u56db\u6761\u952e\u5206\u522b\u767b\u8bb0\u5728\u4e24\u4e2a\u6838\u5fc3\u5b57\u5178\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\u5168\u5c40\u5b57\u5178&#xff08;db-&gt;dict&#xff09;&#xff1a;\u4fdd\u5b58\u5f53\u524d\u5e93\u5185\u5168\u90e8\u952e\u503c\u5bf9&#xff0c;4 \u4e2a\u952e\u5168\u91cf\u5728\u5217&#xff1b;<\/li>\n<li>\u8fc7\u671f\u5b57\u5178&#xff08;db-&gt;expires&#xff09;&#xff1a;\u4ec5\u4fdd\u5b58\u8bbe\u5b9a\u4e86\u5b58\u6d3b\u65f6\u95f4\u7684\u952e&#xff0c;\u5b57\u5178\u7684\u503c\u4e3a 64 \u4f4d\u7edd\u5bf9\u5230\u671f\u6beb\u79d2\u65f6\u95f4\u6233&#xff0c;\u53ea\u6709 session:token:901 \u4e0e cache:order:1024 \u767b\u8bb0\u4e8e\u6b64\u3002<\/li>\n<\/ul>\n<p>\u6709\u4e86\u8fd9\u5c42\u57fa\u51c6&#xff0c;\u518d\u6765\u89c2\u5bdf\u65f6\u949f\u8d8a\u8fc7 5 \u79d2\u540e\u7cfb\u7edf\u7684\u7269\u7406\u8d70\u5411\u3002<\/p>\n<hr \/>\n<h3>\u8fc7\u671f\u952e\u7684\u56de\u6536&#xff1a;\u903b\u8f91\u5931\u6548\u4e0e\u7269\u7406\u91ca\u653e\u7684\u5272\u88c2<\/h3>\n<p>5 \u79d2\u4e4b\u540e&#xff0c;session:token:901 \u5230\u671f\u65f6\u95f4\u5df2\u8fc7\u3002\u5728 Redis \u5185\u6838\u4e2d&#xff0c;\u5230\u8fbe\u622a\u6b62\u65f6\u95f4\u70b9\u53d1\u751f\u7684\u4ec5\u662f\u903b\u8f91\u5931\u6548&#xff0c;\u800c\u975e\u7269\u7406\u5185\u5b58\u7684\u5373\u523b\u91ca\u653e\u3002<\/p>\n<h4>1. \u903b\u8f91\u5931\u6548\u4e0e\u526f\u672c\u8868\u73b0<\/h4>\n<p>\u65f6\u949f\u8d8a\u8fc7\u622a\u6b62\u70b9\u540e&#xff0c;\u5ba2\u6237\u7aef\u53d1\u8d77\u8bfb\u53d6&#xff08;\u5982 GET \/ EXISTS&#xff09;\u65f6&#xff0c;\u4e3b\u8282\u70b9\u6838\u5bf9\u6beb\u79d2\u65f6\u95f4\u6233\u76f4\u63a5\u5224\u5b9a\u8be5\u952e\u4e0d\u5b58\u5728\u5e76\u8fd4\u56de\u7a7a\u3002<\/p>\n<p>\u5728\u4e3b\u4ece\u67b6\u6784\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\u666e\u901a\u53ea\u8bfb\u526f\u672c\u901a\u5e38\u4e0d\u81ea\u4e3b\u7269\u7406\u5220\u9664\u590d\u5236\u6765\u7684\u952e&#xff0c;\u4f46\u53ef\u4f9d\u636e\u672c\u5730\u65f6\u949f\u5bf9\u8bfb\u53d6\u8fdb\u884c\u9690\u85cf&#xff0c;\u8fd4\u56de\u7a7a\u6216\u89c6\u4f5c\u4e0d\u5b58\u5728&#xff1b;<\/li>\n<li>\u7269\u7406\u5220\u9664\u4ecd\u4f9d\u8d56\u4e3b\u8282\u70b9\u540c\u6b65\u3002\u4e3b\u8282\u70b9\u6267\u884c\u5220\u9664\u65f6&#xff0c;\u4f1a\u5411\u4ece\u8282\u70b9\u4e0e AOF \u4f20\u64ad\u5220\u9664\u547d\u4ee4&#xff0c;\u5177\u4f53\u4e3a DEL \u6216 UNLINK&#xff08;\u53d6\u51b3\u4e8e\u662f\u5426\u914d\u7f6e\u4e86 lazyfree-lazy-expire \u7b49&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u82e5\u5230\u671f\u540e\u65e0\u4eba\u8bbf\u95ee&#xff0c;\u4e14\u5c1a\u672a\u88ab\u4e3b\u52a8\u626b\u63cf\u62bd\u6837\u547d\u4e2d&#xff0c;\u8be5\u952e\u53ef\u80fd\u5c1a\u672a\u88ab\u7269\u7406\u6e05\u7406&#xff0c;\u7ee7\u7eed\u9a7b\u7559\u5806\u5185\u5b58\u4e2d&#xff0c;\u56e0\u6b64\u76d1\u63a7\u5185\u5b58\u7eb9\u4e1d\u4e0d\u52a8\u3002<\/p>\n<h4>2. \u7269\u7406\u56de\u6536\u7684\u4e24\u6761\u534f\u540c\u8def\u5f84<\/h4>\n<p>\u8981\u8ba9\u8d85\u671f\u952e\u5360\u7528\u7684\u5185\u5b58\u771f\u6b63\u8fd4\u8fd8&#xff0c;\u4f9d\u8d56\u4e24\u6761\u534f\u540c\u8fd0\u884c\u7684\u56de\u6536\u8def\u5f84&#xff1a;<\/p>\n<h5>\u8def\u5f84 A&#xff1a;\u60f0\u6027\u5220\u9664&#xff08;Lazy Deletion&#xff09;<\/h5>\n<p>\u60f0\u6027\u5220\u9664\u5c5e\u4e8e\u5e38\u89c4\u8bbf\u95ee\u8def\u5f84\u4e0a\u7684\u88ab\u52a8\u62e6\u622a\u3002\u4e3b\u7ebf\u7a0b\u5728\u5e38\u89c4\u8c03\u7528\u94fe\u4e2d\u4f1a\u8c03\u7528 expireIfNeeded()&#xff08;\u4f4d\u4e8e src\/db.c&#xff09;\u3002<\/p>\n<p>\u8bfb\u53d6\u547d\u4ee4&#xff08;\u5982 GET \/ EXISTS&#xff09;\u547d\u4e2d\u8d85\u671f\u952e\u65f6&#xff0c;\u4e3b\u7ebf\u7a0b\u5c06\u5176\u4ece\u5168\u5c40\u5b57\u5178\u4e0e\u8fc7\u671f\u5b57\u5178\u8131\u94fe\u6458\u9664&#xff0c;\u5411\u5ba2\u6237\u7aef\u8fd4\u56de\u7a7a\u3002\u60f0\u6027\u5220\u9664\u5e76\u4e0d\u610f\u5473\u7740\u6240\u6709\u547d\u4ee4\u90fd\u4f1a\u8fd4\u56de\u7a7a&#xff1b;\u4f8b\u5982\u5199\u5165\u547d\u4ee4 SET&#xff0c;\u68c0\u6d4b\u5230\u65e7\u952e\u8fc7\u671f\u540e\u4f1a\u5c06\u5176\u89c6\u4f5c\u4e0d\u5b58\u5728\u5e76\u8986\u5199\u65b0\u503c\u3002<\/p>\n<p>\u60f0\u6027\u5220\u9664\u5c06\u5f00\u9500\u5206\u644a\u5728\u8bbf\u95ee\u4e2d&#xff0c;\u5bf9 CPU \u5e73\u6ed1&#xff0c;\u4f46\u5b8c\u5168\u4e0d\u88ab\u8bbf\u95ee\u7684\u51b7\u952e\u65e0\u6cd5\u89e6\u53d1\u3002<\/p>\n<h5>\u8def\u5f84 B&#xff1a;\u4e3b\u52a8\u8fc7\u671f&#xff08;Active Expiration&#xff09;<\/h5>\n<p>\u9488\u5bf9\u51b7\u952e&#xff0c;\u4e3b\u7ebf\u7a0b\u901a\u8fc7 activeExpireCycle()&#xff08;\u4f4d\u4e8e src\/expire.c&#xff09;\u8fdb\u884c\u5468\u671f\u6027\u589e\u91cf\u6e05\u7406\u3002<\/p>\n<p>Redis \u65e2\u4e0d\u4e3a\u6bcf\u4e2a\u952e\u5206\u914d\u72ec\u7acb\u5b9a\u65f6\u5668&#xff0c;\u4e5f\u4e0d\u4f1a\u5b9a\u65f6\u5168\u5e93\u5168\u91cf\u626b\u63cf\u3002\u4e3b\u52a8\u8fc7\u671f\u662f\u4e3b\u7ebf\u7a0b\u5728\u65f6\u95f4\u9884\u7b97\u7ea6\u675f\u4e0b\u7684\u589e\u91cf\u62bd\u6837\u56de\u6536&#xff1a;<\/p>\n<ul>\n<li>\u6267\u884c\u65f6\u673a&#xff1a;\u5206\u4e3a\u6162\u901f\u5468\u671f&#xff08;SLOW&#xff0c;\u7531 serverCron \u9a71\u52a8&#xff0c;\u6267\u884c\u9891\u7387\u7531 hz \u51b3\u5b9a\u4e14\u652f\u6301 dynamic-hz \u52a8\u6001\u8c03\u6574&#xff09;\u4e0e\u5feb\u901f\u5468\u671f&#xff08;FAST&#xff0c;\u5728 beforeSleep \u4e2d\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u89e6\u53d1&#xff0c;\u5e76\u975e\u6bcf\u6b21\u4f11\u7720\u524d\u90fd\u771f\u6b63\u626b\u63cf&#xff09;&#xff1b;<\/li>\n<li>\u62bd\u6837\u4e0e\u9884\u7b97&#xff1a;\u4e3b\u7ebf\u7a0b\u589e\u91cf\u904d\u5386 db-&gt;expires \u968f\u673a\u62bd\u6837&#xff0c;\u6839\u636e\u62bd\u6837\u4e2d\u8fc7\u671f\u952e\u79ef\u538b\u7a0b\u5ea6\u51b3\u5b9a\u662f\u5426\u7ee7\u7eed&#xff0c;\u540c\u65f6\u53d7\u53ef\u8c03\u7684\u65f6\u95f4\u9884\u7b97\u7ea6\u675f\u3002\u9884\u7b97\u68c0\u67e5\u5728\u5206\u6279\u8fed\u4ee3\u4e2d\u63a8\u8fdb&#xff0c;\u5355\u4e2a\u5927\u5bf9\u8c61\u6790\u6784\u4e5f\u6d88\u8017\u8017\u65f6&#xff0c;\u5e76\u975e\u4e25\u683c\u7acb\u523b\u4e2d\u65ad\u6216\u56fa\u5b9a\u7684\u5168\u8fdb\u7a0b CPU \u4e0a\u9650\u3002<\/li>\n<\/ul>\n<p>\u4e24\u5957\u673a\u5236\u534f\u540c\u5de5\u4f5c&#xff1a;\u4efb\u4e00\u8def\u5f84\u5148\u6458\u9664\u8be5\u952e\u540e&#xff0c;\u53e6\u4e00\u8def\u5f84\u540e\u7eed\u4e0d\u518d\u91cd\u590d\u5220\u9664\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261108083254-6af033b66f7a2.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h3>\u5f53\u5185\u5b58\u903c\u8fd1 maxmemory&#xff1a;8 \u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565<\/h3>\n<p>\u5982\u679c\u5927\u91cf\u952e\u5c1a\u672a\u5230\u671f&#xff08;\u5982 cache:order:1024 \u8fd8\u5269 3600 \u79d2&#xff09;&#xff0c;\u6216\u6839\u672c\u672a\u8bbe\u7f6e TTL&#xff08;\u5982\u6301\u4e45\u952e config:whitelist \u4e0e counter:active_uv&#xff09;&#xff0c;\u8fc7\u671f\u5220\u9664\u673a\u5236\u4fbf\u65e0\u80fd\u4e3a\u529b\u3002<\/p>\n<p>\u5f53\u5185\u5b58\u5360\u7528\u903c\u8fd1\u4e0a\u9650\u65f6&#xff0c;**\u5185\u5b58\u6dd8\u6c70\u673a\u5236&#xff08;Eviction&#xff09;**\u63a5\u7ba1\u3002<\/p>\n<h4>1. \u89e6\u53d1\u65f6\u673a\u4e0e\u5019\u9009\u8303\u56f4<\/h4>\n<p>\u5185\u5b58\u6dd8\u6c70\u5e76\u4e0d\u53ea\u9650\u4e8e\u4e0b\u4e00\u6761\u5199\u547d\u4ee4\u5230\u8fbe\u65f6\u3002\u5728\u5e38\u89c4\u547d\u4ee4\u8def\u5f84 processCommand \u4e2d&#xff0c;\u7b26\u5408\u6761\u4ef6\u7684\u4e3b\u7ebf\u7a0b\u4f1a\u5728\u6267\u884c\u547d\u4ee4\u524d\u8c03\u7528 performEvictions()&#xff08;\u4f4d\u4e8e src\/evict.c&#xff09;&#xff1b;\u6b64\u5916&#xff0c;\u5728\u540e\u7eed\u65f6\u95f4\u4e8b\u4ef6\u7b49\u8c03\u5ea6\u4e2d&#xff0c;Redis \u4e5f\u4f1a\u6301\u7eed\u68c0\u6d4b\u5e76\u5c1d\u8bd5\u6dd8\u6c70\u3002<\/p>\n<p>\u7b56\u7565\u7684\u5019\u9009\u8303\u56f4\u5206\u4e3a\u4e24\u7c7b&#xff1a;<\/p>\n<ul>\n<li>allkeys-*&#xff1a;\u5019\u9009\u8303\u56f4\u6765\u81ea db-&gt;dict \u5168\u91cf\u5b57\u5178&#xff0c;\u57fa\u51c6 4 \u952e\u5168\u90e8\u7eb3\u5165\u5019\u9009\u89c6\u91ce&#xff1b;<\/li>\n<li>volatile-*&#xff1a;\u5019\u9009\u8303\u56f4\u6765\u81ea db-&gt;expires \u8fc7\u671f\u5b57\u5178\u3002\u65e2\u5305\u542b\u5c1a\u672a\u5230\u671f\u7684\u952e&#xff0c;\u4e5f\u4e0d\u6392\u9664\u903b\u8f91\u4e0a\u5df2\u5230\u671f\u4f46\u5c1a\u672a\u88ab\u7269\u7406\u6e05\u7406\u7684\u952e&#xff1b;\u5b83\u5e76\u4e0d\u4e13\u6307\u5df2\u5230\u671f\u952e&#xff0c;\u4f46\u4e0d\u80fd\u5c06\u5176\u9650\u5b9a\u4e3a\u201c\u5c1a\u672a\u5230\u671f\u7684\u5408\u6cd5\u952e\u201d\u3002\u82e5\u5e93\u5185\u5168\u4e3a\u6301\u4e45\u952e&#xff0c;volatile-* \u6293\u4e0d\u5230\u5019\u9009&#xff0c;\u65e0\u6cd5\u817e\u51fa\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n<h4>2. \u516b\u79cd\u6dd8\u6c70\u7b56\u7565\u5bf9\u6bd4<\/h4>\n<p>Redis 7.2.4 \u63d0\u4f9b\u4e86 8 \u79cd\u6dd8\u6c70\u7b56\u7565&#xff0c;\u6838\u5fc3\u5dee\u5f02\u5728\u4e8e\u5019\u9009\u8303\u56f4\u4e0e\u6dd8\u6c70\u89c4\u5219\u7684\u7ec4\u5408&#xff1a;<\/p>\n<table>\n<tr>\u7b56\u7565\u540d\u79f0\u5019\u9009\u8303\u56f4\u6dd8\u6c70\u89c4\u5219<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">noeviction<\/td>\n<td align=\"left\">\u4e0d\u6dd8\u6c70\u952e<\/td>\n<td align=\"left\">\u4e0d\u9a71\u9010\u4efb\u4f55\u6570\u636e&#xff0c;\u5185\u5b58\u8d85\u9650\u65f6\u62d2\u7edd\u90e8\u5206\u5199\u5165\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">allkeys-lru<\/td>\n<td align=\"left\">db-&gt;dict (\u5168\u91cf\u952e)<\/td>\n<td align=\"left\">\u4f18\u5148\u6dd8\u6c70\u7a7a\u95f2\u65f6\u95f4\u6700\u957f&#xff08;\u8ddd\u4e0a\u6b21\u8bbf\u95ee\u6700\u4e45\u8fdc&#xff09;\u7684\u952e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">allkeys-lfu<\/td>\n<td align=\"left\">db-&gt;dict (\u5168\u91cf\u952e)<\/td>\n<td align=\"left\">\u4f18\u5148\u6dd8\u6c70\u8fd1\u4f3c\u8bbf\u95ee\u9891\u7387\u6700\u4f4e\u7684\u952e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">allkeys-random<\/td>\n<td align=\"left\">db-&gt;dict (\u5168\u91cf\u952e)<\/td>\n<td align=\"left\">\u968f\u673a\u62bd\u53d6\u952e\u8fdb\u884c\u9a71\u9010<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">volatile-lru<\/td>\n<td align=\"left\">db-&gt;expires (\u5e26TTL\u952e)<\/td>\n<td align=\"left\">\u4f18\u5148\u6dd8\u6c70\u5e26 TTL \u952e\u4e2d\u7a7a\u95f2\u65f6\u95f4\u6700\u957f\u7684\u952e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">volatile-lfu<\/td>\n<td align=\"left\">db-&gt;expires (\u5e26TTL\u952e)<\/td>\n<td align=\"left\">\u4f18\u5148\u6dd8\u6c70\u5e26 TTL \u952e\u4e2d\u8fd1\u4f3c\u8bbf\u95ee\u9891\u7387\u6700\u4f4e\u7684\u952e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">volatile-random<\/td>\n<td align=\"left\">db-&gt;expires (\u5e26TTL\u952e)<\/td>\n<td align=\"left\">\u968f\u673a\u62bd\u53d6\u5e26 TTL \u7684\u952e\u8fdb\u884c\u9a71\u9010<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">volatile-ttl<\/td>\n<td align=\"left\">db-&gt;expires (\u5e26TTL\u952e)<\/td>\n<td align=\"left\">\u4f18\u5148\u6dd8\u6c70\u5269\u4f59\u5b58\u6d3b\u65f6\u95f4\u6700\u77ed\u7684\u952e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3. \u7a7a\u95f4\u4e0d\u8db3\u65f6\u7684\u62d2\u7edd\u8868\u73b0<\/h4>\n<p>\u9ed8\u8ba4\u7b56\u7565\u662f noeviction\u3002<\/p>\n<p>\u5f53\u914d\u7f6e\u4e3a noeviction&#xff0c;\u6216\u7b56\u7565\u5728\u5019\u9009\u96c6\u5408\u4e2d\u65e0\u6cd5\u817e\u51fa\u8db3\u591f\u5185\u5b58\u65f6&#xff0c;Redis \u4e0d\u4f1a\u505c\u6b62\u670d\u52a1&#xff1a;<\/p>\n<ul>\n<li>\u5185\u6838\u4e0d\u4f1a\u5728\u6267\u884c\u524d\u7cbe\u786e\u9884\u4f30\u8be5\u547d\u4ee4\u5b9e\u9645\u5c06\u5206\u914d\u591a\u5c11\u5b57\u8282&#xff1b;<\/li>\n<li>\u800c\u662f\u6839\u636e\u547d\u4ee4\u6807\u5fd7\u4f4d&#xff0c;\u76f4\u63a5\u62e6\u622a\u5e26\u6709 CMD_DENYOOM&#xff08;denyoom&#xff09;\u6807\u5fd7\u7684\u547d\u4ee4&#xff08;\u5982\u5e38\u89c1\u7684 SET\u3001HSET\u3001LPUSH \u7b49\u53ef\u80fd\u589e\u52a0\u5185\u5b58\u5360\u7528\u7684\u64cd\u4f5c&#xff09;&#xff0c;\u8fd4\u56de\u9519\u8bef&#xff1a;OOM command not allowed when used memory &gt; &#039;maxmemory&#039;&#xff1b;<\/li>\n<li>\u8bfb\u547d\u4ee4&#xff08;\u5982 GET\u3001EXISTS&#xff09;\u4ee5\u53ca\u91ca\u653e\u547d\u4ee4&#xff08;\u5982 DEL&#xff09;\u4e0d\u5e26\u8be5\u6807\u5fd7&#xff0c;\u901a\u5e38\u4f9d\u7136\u53ef\u4ee5\u6b63\u5e38\u6267\u884c&#xff1b;<\/li>\n<li>\u5185\u6838\u4ea6\u4e0d\u627f\u8bfa\u6bcf\u6b21\u6dd8\u6c70\u90fd\u4e00\u5b9a\u80fd\u5c06\u6c34\u4f4d\u5f7b\u5e95\u538b\u56de\u8fbe\u6807\u7ebf\u4ee5\u4e0b\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261108083255-6af033b70eb54.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h3>\u8fd1\u4f3c\u673a\u5236\u7684\u8bbe\u8ba1\u6743\u8861&#xff1a;LRU \u4e0e LFU \u7684\u5185\u6838\u5b9e\u73b0<\/h3>\n<p>\u5982\u679c\u5b9e\u73b0\u4e25\u683c\u7684 LRU \u6216 LFU&#xff0c;\u9700\u8981\u7ef4\u62a4\u8986\u76d6\u5168\u5e93\u7684\u5168\u5c40\u94fe\u8868\u6216\u6392\u5e8f\u6811&#xff0c;\u6bcf\u6b21\u8bfb\u5199\u90fd\u8981\u8c03\u6574\u8282\u70b9&#xff0c;\u5355\u7ebf\u7a0b\u6a21\u578b\u4e0b\u5185\u5b58\u4e0e CPU \u5f00\u9500\u6c89\u91cd\u3002<\/p>\n<p>Redis \u91c7\u7528\u7684\u662f\u5c0f\u6837\u672c\u968f\u673a\u62bd\u6837\u4e0e\u5c40\u90e8\u5019\u9009\u6c60\u7684\u8fd1\u4f3c\u673a\u5236\u3002<\/p>\n<h4>1. LRU \u4e0e LFU \u7684\u8003\u91cf\u7ef4\u5ea6<\/h4>\n<p>\u5728\u5bf9\u8c61\u5185\u90e8&#xff0c;Redis \u7ef4\u62a4\u4e86\u8bbf\u95ee\u4e0e\u65f6\u95f4\u76f8\u5173\u7684\u5143\u6570\u636e&#xff1a;<\/p>\n<ul>\n<li>LRU&#xff08;\u6700\u8fd1\u6700\u5c11\u4f7f\u7528&#xff09;&#xff1a;\u5173\u6ce8\u5bf9\u8c61\u7684\u7a7a\u95f2\u65f6\u957f&#xff08;Idle Time&#xff09;\u3002\u901a\u8fc7\u5f53\u524d\u65f6\u949f\u51cf\u53bb\u5bf9\u8c61\u8bb0\u5f55\u7684\u8bbf\u95ee\u65f6\u95f4\u6233&#xff0c;\u5dee\u503c\u8d8a\u5927\u4ee3\u8868\u8d8a\u4e45\u672a\u88ab\u4f7f\u7528&#xff0c;\u5728\u62bd\u6837\u4e2d\u4f18\u5148\u88ab\u6dd8\u6c70&#xff1b;<\/li>\n<li>LFU&#xff08;\u6700\u4e0d\u7ecf\u5e38\u4f7f\u7528&#xff09;&#xff1a;\u7efc\u5408\u8003\u91cf\u8bbf\u95ee\u9891\u6b21\u4e0e\u65f6\u95f4\u8870\u51cf\u3002\u6bcf\u6b21\u8bbf\u95ee\u65f6\u6309\u5bf9\u6570\u6982\u7387\u63d0\u5347\u8ba1\u6570&#xff0c;\u540c\u65f6\u6839\u636e\u8ddd\u79bb\u4e0a\u6b21\u8bbf\u95ee\u8de8\u8d8a\u7684\u65f6\u95f4\u6267\u884c\u8870\u51cf\u3002\u7a81\u53d1\u6279\u91cf\u8bbf\u95ee\u4f46\u540e\u7eed\u6c89\u5bc2\u7684\u51b7\u952e&#xff0c;\u5176\u8ba1\u6570\u4f1a\u968f\u65f6\u95f4\u8fc5\u901f\u8870\u51cf&#xff0c;\u4ece\u800c\u907f\u514d\u51b2\u5237\u6389\u771f\u6b63\u957f\u671f\u9ad8\u9891\u7684\u70ed\u70b9\u952e\u3002<\/li>\n<\/ul>\n<p>\u9700\u8981\u5f3a\u8c03\u7684\u662f&#xff0c;\u540c\u4e00\u5bf9\u8c61\u7684\u5143\u6570\u636e\u662f\u6839\u636e\u5f53\u524d\u751f\u6548\u7684\u6dd8\u6c70\u7b56\u7565\u6765\u89e3\u91ca\u7684&#xff0c;\u5185\u6838\u4e0d\u4f1a\u5728\u540c\u4e00\u65f6\u523b\u540c\u65f6\u7ef4\u62a4\u7cbe\u786e\u7684 LRU \u7edd\u5bf9\u7a7a\u95f2\u65f6\u957f\u4e0e LFU \u8bbf\u95ee\u9891\u6b21\u3002<\/p>\n<h4>2. \u62bd\u6837\u4e0e\u6dd8\u6c70\u5019\u9009\u6c60<\/h4>\n<p>\u4e3a\u4e86\u903c\u8fd1\u5168\u5c40\u6392\u5e8f&#xff0c;Redis \u91c7\u7528\u62bd\u6837\u5019\u9009\u673a\u5236&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u4e8e LRU\u3001LFU \u4e0e volatile-ttl \u7b56\u7565&#xff0c;\u4e3b\u7ebf\u7a0b\u6bcf\u6b21\u4ece\u76ee\u6807\u5b57\u5178\u968f\u673a\u62bd\u53d6\u82e5\u5e72\u6837\u672c&#xff0c;\u8ba1\u7b97\u6dd8\u6c70\u6743\u91cd&#xff0c;\u5e76\u6309\u5347\u5e8f\u7ef4\u62a4\u5728\u56fa\u5b9a\u5bb9\u91cf\u7684\u5c40\u90e8\u6709\u5e8f\u5019\u9009\u6c60\u4e2d&#xff0c;\u968f\u540e\u5f39\u51fa\u6c60\u4e2d\u6700\u4f18\u7684\u952e\u6267\u884c\u5220\u9664&#xff1b;<\/li>\n<li>volatile-ttl \u4ec5\u662f\u5728\u62bd\u6837\u6837\u672c\u4e2d\u504f\u5411\u6dd8\u6c70\u5269\u4f59\u5b58\u6d3b\u65f6\u95f4\u66f4\u77ed\u7684\u952e&#xff0c;\u5e76\u4e0d\u4fdd\u8bc1\u627e\u5230\u5168\u5e93\u7edd\u5bf9\u6700\u77ed TTL&#xff1b;<\/li>\n<li>\u5bf9\u4e8e random&#xff08;allkeys-random \u4e0e volatile-random&#xff09;\u7b56\u7565&#xff0c;\u5219\u662f\u76f4\u63a5\u968f\u673a\u62bd\u53d6\u952e\u8fdb\u884c\u7269\u7406\u9a71\u9010&#xff0c;\u4e0d\u7ecf\u8fc7\u6709\u5e8f\u5019\u9009\u6c60\u7684\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u8fd9\u79cd\u5c40\u90e8\u6837\u672c\u62bd\u6837&#xff0c;Redis \u907f\u514d\u4e86\u7ef4\u62a4\u5168\u5c40\u94fe\u8868\u7684\u6c89\u91cd\u8d1f\u62c5&#xff0c;\u4ee5\u6781\u4f4e\u7684\u6027\u80fd\u5f00\u9500\u83b7\u5f97\u4e86\u903c\u8fd1\u5168\u5c40\u6392\u5e8f\u7684\u9a71\u9010\u6548\u679c\u3002<\/p>\n<hr \/>\n<h3>\u7269\u7406\u5185\u5b58\u7684\u771f\u5b9e\u8fb9\u754c\u4e0e\u5e95\u5c42\u907f\u5751<\/h3>\n<p>\u56f4\u7ed5\u5185\u5b58\u7ba1\u7406&#xff0c;\u6709\u56db\u4e2a\u5bb9\u6613\u6df7\u6dc6\u7684\u7269\u7406\u8fb9\u754c&#xff1a;<\/p>\n<h4>1. maxmemory \u4e0d\u662f\u64cd\u4f5c\u7cfb\u7edf RSS \u7684\u786c\u4e0a\u9650<\/h4>\n<p>maxmemory \u9650\u5236\u7684\u662f Redis \u5185\u90e8\u7edf\u8ba1\u7684\u5df2\u7528\u5185\u5b58&#xff08;used_memory&#xff09;&#xff0c;\u5e76\u5728\u6838\u7b97\u65f6\u6263\u9664\u4e86\u90e8\u5206\u4e0d\u8ba1\u5165\u6dd8\u6c70\u7684\u7279\u5b9a\u7f13\u51b2&#xff08;\u4f8b\u5982\u4e3b\u4ece\u590d\u5236\u8f93\u51fa\u7f13\u51b2\u7b49&#xff09;\u3002\u5b83\u65e2\u4e0d\u662f\u7eaf\u6570\u636e\u96c6\u5360\u7528&#xff0c;\u66f4\u4e0d\u662f\u64cd\u4f5c\u7cfb\u7edf\u5c42\u9762\u7684\u5e38\u9a7b\u7269\u7406\u5185\u5b58&#xff08;RSS&#xff09;\u3002\u8fdb\u7a0b RSS \u8fd8\u5305\u542b\u5185\u5b58\u5206\u914d\u5668\u7684\u788e\u7247\u3001\u8f93\u5165\u8f93\u51fa\u7f51\u7edc\u7f13\u51b2\u7b49\u3002\u7269\u7406\u5185\u5b58 RSS \u660e\u663e\u9ad8\u4e8e maxmemory \u5c5e\u4e8e\u6b63\u5e38\u73b0\u8c61&#xff0c;\u5207\u52ff\u5c06 maxmemory \u8bbe\u4e3a\u7269\u7406\u673a\u603b\u5185\u5b58\u7684 100%\u3002<\/p>\n<h4>2. \u6267\u884c\u5927\u547d\u4ee4\u5141\u8bb8\u77ed\u65f6\u8d85\u51fa<\/h4>\n<p>Redis \u68c0\u67e5\u6dd8\u6c70\u53d1\u751f\u5728\u5904\u7406\u547d\u4ee4\u7684\u8fc7\u7a0b\u4e2d\u3002\u5355\u6761\u547d\u4ee4\u5199\u5165\u8d85\u5927\u5bf9\u8c61\u65f6&#xff0c;\u5206\u914d\u64cd\u4f5c\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u77ac\u95f4\u8d85\u51fa maxmemory\u3002\u8fd9\u79cd\u8d85\u51fa\u5e76\u975e\u65e0\u9650\u5236&#xff0c;\u5728\u540e\u7eed\u5e38\u89c4\u547d\u4ee4\u5904\u7406\u8def\u5f84\u53ca\u65f6\u95f4\u4e8b\u4ef6\u8c03\u5ea6\u4e2d&#xff0c;\u5185\u6838\u4f1a\u6301\u7eed\u68c0\u6d4b\u5e76\u7ee7\u7eed\u5c1d\u8bd5\u6dd8\u6c70\u3002<\/p>\n<h4>3. \u5f02\u6b65\u91ca\u653e&#xff08;Lazy Free&#xff09;\u7684\u6743\u8d23\u8fb9\u754c<\/h4>\n<p>\u914d\u7f6e\u9879 lazyfree-lazy-expire \u4e0e lazyfree-lazy-eviction \u5728 7.2.4 \u9ed8\u8ba4\u5747\u4e3a no\u3002\u5373\u4fbf\u5f00\u542f&#xff0c;\u540e\u53f0 I\/O \u7ebf\u7a0b\u8d1f\u8d23\u7684\u4ec5\u4ec5\u662f\u7b26\u5408\u6761\u4ef6\u7684\u5927\u5bf9\u8c61\u5e95\u5c42\u5185\u5b58\u5757\u7684\u89e3\u6784\u4e0e\u9500\u6bc1\u3002\u800c\u8fc7\u671f\u7684\u5224\u5b9a\u3001\u6dd8\u6c70\u5019\u9009\u6c60\u7684\u91c7\u6837\u8ba1\u7b97\u3001\u4ee5\u53ca\u5c06\u952e\u4ece\u5b57\u5178\u4e2d\u89e3\u7ed1\u6458\u9664&#xff0c;\u4f9d\u7136\u7531\u4e3b\u7ebf\u7a0b\u540c\u6b65\u5b8c\u6210\u3002<\/p>\n<h4>4. \u5bf9\u8c61\u89e3\u7ed1\u4e0d\u7b49\u4e8e\u64cd\u4f5c\u7cfb\u7edf RSS \u7acb\u5373\u56de\u843d<\/h4>\n<p>\u4e00\u4e2a\u952e\u4ece\u5b57\u5178\u6458\u9664\u540e&#xff0c;\u5176\u5185\u5b58\u91ca\u653e\u7ecf\u5386\u4e0d\u540c\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u82e5\u4ea4\u7531 lazyfree \u540e\u53f0\u6790\u6784&#xff0c;\u540e\u53f0\u5b8c\u6210\u91ca\u653e\u524d used_memory \u5e76\u4e0d\u4f1a\u7acb\u5373\u4e0b\u964d&#xff1b;<\/li>\n<li>\u5373\u4f7f\u5e95\u5c42\u7684\u5185\u5b58\u8c03\u7528\u88ab\u6267\u884c\u3001used_memory \u56de\u843d&#xff0c;\u8fdb\u7a0b RSS \u4e5f\u5f80\u5f80\u5e73\u7a33\u4e0d\u53d8\u3002\u8fd9\u662f\u7531\u4e8e\u5185\u5b58\u5206\u914d\u5668&#xff08;\u5982 jemalloc&#xff09;\u4e3a\u4e86\u517c\u987e\u540e\u7eed\u5206\u914d\u6548\u7387&#xff0c;\u4f1a\u5c06\u5185\u5b58\u4fdd\u7559\u5728\u5176\u5185\u5b58\u6c60\u4e2d\u590d\u7528&#xff0c;\u4e0d\u4f1a\u7acb\u523b\u5f52\u8fd8\u7ed9\u64cd\u4f5c\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u6dd8\u6c70\u7b56\u7565\u7684\u9009\u578b\u5e94\u7ed3\u5408\u6570\u636e\u53ef\u6062\u590d\u6027\u3001\u8bbf\u95ee\u6a21\u5f0f\u4ee5\u53ca\u5bf9\u5199\u5165\u4e2d\u65ad\u7684\u5bb9\u5fcd\u5ea6\u7efc\u5408\u8003\u91cf&#xff1a;<\/p>\n<ul>\n<li>\u6570\u636e\u53ef\u5b8c\u5168\u7531\u540e\u7aef\u5b58\u50a8\u91cd\u5efa&#xff0c;\u4e14\u8bbf\u95ee\u5b58\u5728\u660e\u663e\u4e8c\u516b\u503e\u659c&#xff1a;\u9009\u7528 allkeys-lru&#xff0c;\u8ba9\u51b7\u6570\u636e\u81ea\u7136\u8ba9\u51fa\u7a7a\u95f4&#xff1b;<\/li>\n<li>\u4e1a\u52a1\u5b58\u5728\u5468\u671f\u6027\u6279\u91cf\u626b\u5e93\u6216\u7a81\u53d1\u6027\u904d\u5386&#xff1a;\u9009\u7528 allkeys-lfu&#xff0c;\u907f\u514d\u4e00\u6b21\u6027\u7a81\u53d1\u6d41\u91cf\u51b2\u5237\u6389\u957f\u671f\u9ad8\u9891\u70ed\u70b9&#xff1b;<\/li>\n<li>\u7f13\u5b58\u4e0e\u5fc5\u987b\u4fdd\u7559\u7684\u6301\u4e45\u6570\u636e\u6df7\u90e8&#xff1a;\u53ef\u9009\u7528 volatile-lru \u6216 volatile-lfu\u3002\u672a\u8bbe TTL \u7684\u952e\u4e0d\u53c2\u4e0e\u6dd8\u6c70\u5019\u9009&#xff0c;\u4f46\u5e76\u4e0d\u6784\u6210\u5168\u5c40\u201c\u7edd\u5bf9\u4e0d\u4e22\u201d&#xff1b;\u82e5\u5e0c\u671b\u5199\u5165\u4e25\u683c\u53d7\u63a7\u4e14\u4e1a\u52a1\u8981\u6c42\u660e\u786e\u62a5\u9519&#xff0c;\u53ef\u4fdd\u7559\u9ed8\u8ba4 noeviction&#xff0c;\u901a\u8fc7\u62a5\u8b66\u89e6\u53d1\u4eba\u5de5\u4ecb\u5165\u6216\u96c6\u7fa4\u6269\u5bb9&#xff1b;<\/li>\n<li>\u5e26 TTL \u7684\u952e\u9700\u8981\u6309\u65f6\u6548\u504f\u5411\u6e05\u7406&#xff1a;\u53ef\u9009\u7528 volatile-ttl&#xff0c;\u4f46\u9700\u660e\u786e&#xff0c;\u5b83\u5e76\u4e0d\u4fdd\u8bc1\u952e\u80fd\u5b8c\u597d\u5b58\u6ee1\u5176\u751f\u547d\u5468\u671f&#xff0c;\u5728\u5bb9\u91cf\u5403\u7d27\u65f6\u4f9d\u7136\u4f1a\u88ab\u63d0\u524d\u9a71\u9010\u3002<\/li>\n<\/ul>\n<p>\u5728\u76d1\u63a7\u6392\u67e5\u4e2d&#xff0c;INFO stats \u8f93\u51fa\u7684\u4e24\u4e2a\u6838\u5fc3\u8ba1\u6570\u5668\u9700\u7406\u6027\u7814\u5224&#xff1a;<\/p>\n<ul>\n<li>expired_keys&#xff1a;\u7d2f\u8ba1\u901a\u8fc7\u8fc7\u671f\u673a\u5236\u6b63\u5e38\u7ec8\u7ed3\u7684\u952e\u603b\u6570&#xff1b;<\/li>\n<li>evicted_keys&#xff1a;\u7d2f\u8ba1\u56e0\u89e6\u78b0\u5185\u5b58\u4e0a\u9650\u88ab\u6dd8\u6c70\u673a\u5236\u5f3a\u5236\u9a71\u9010\u7684\u952e\u603b\u6570\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e24\u4e2a\u6307\u6807\u5747\u4e3a\u5355\u8c03\u9012\u589e\u7684\u7d2f\u79ef\u8ba1\u6570&#xff0c;\u5355\u770b\u7edd\u5bf9\u503c\u65e0\u6cd5\u5b9a\u6027\u5065\u5eb7\u72b6\u51b5&#xff0c;\u5fc5\u987b\u89c2\u5bdf\u5355\u4f4d\u65f6\u95f4\u5185\u7684\u589e\u91cf\u901f\u7387&#xff0c;\u5e76\u7ed3\u5408\u7f13\u5b58\u547d\u4e2d\u7387\u4e0e\u5185\u5b58\u6c34\u4f4d\u7efc\u5408\u5206\u6790\u3002evicted_keys \u7684\u6301\u7eed\u589e\u957f\u53cd\u6620\u51fa\u6d3b\u8dc3\u5de5\u4f5c\u96c6\u53ef\u80fd\u6b63\u5728\u6311\u6218\u914d\u7f6e\u7684\u5bb9\u91cf\u8fb9\u754c&#xff1b;\u82e5\u56e0\u6b64\u5bfc\u81f4\u540e\u7aef\u6570\u636e\u5e93\u67e5\u8be2\u589e\u591a&#xff0c;\u5c5e\u4e8e\u7f13\u5b58\u7f3a\u5931\u5f15\u53d1\u7684\u5e38\u89c4\u56de\u6e90&#xff0c;\u4e0d\u5e94\u6df7\u540c\u4e8e\u9488\u5bf9\u4e0d\u5b58\u5728\u6570\u636e\u7684\u201c\u7f13\u5b58\u7a7f\u900f\u201d\u3002<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":123992,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[105,292,100,1813,398],"topic":[],"class_list":["post-123994","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-redis","tag-292","tag-100","tag-1813","tag-398"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/123994.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/123994.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-08T08:32:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261108083254-6af033b66f7a2.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123994.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/123994.html\",\"name\":\"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-08T08:32:56+00:00\",\"dateModified\":\"2026-11-08T08:32:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/123994.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/123994.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123994.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/123994.html","og_locale":"zh_CN","og_type":"article","og_title":"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/123994.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-08T08:32:56+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261108083254-6af033b66f7a2.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/123994.html","url":"https:\/\/www.wsisp.com\/helps\/123994.html","name":"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-08T08:32:56+00:00","dateModified":"2026-11-08T08:32:56+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/123994.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/123994.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/123994.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u952e\u5230\u671f\u4e86\u4e3a\u4ec0\u4e48\u8fd8\u5360\u5185\u5b58\uff1fRedis\u7684\u8fc7\u671f\u5220\u9664\u4e0e8\u79cd\u5185\u5b58\u6dd8\u6c70\u7b56\u7565"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=123994"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123994\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/123992"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=123994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=123994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=123994"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=123994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}