{"id":22960,"date":"2025-12-09T21:26:40","date_gmt":"2025-12-09T13:26:40","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=22960"},"modified":"2025-12-09T21:29:11","modified_gmt":"2025-12-09T13:29:11","slug":"wordpress-%e4%bd%bf%e7%94%a8-redis-%e5%af%b9%e8%b1%a1%e7%bc%93%e5%ad%98","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=22960","title":{"rendered":"WordPress \u4f7f\u7528 Redis \u5bf9\u8c61\u7f13\u5b58"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.iyatt.com\/?p=22960\/#%E5%89%8D%E8%A8%80\" >\u524d\u8a00<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.iyatt.com\/?p=22960\/#%E6%93%8D%E4%BD%9C\" >\u64cd\u4f5c<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E5%89%8D%E8%A8%80\"><\/span>\u524d\u8a00<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>2025\/12\/9<br \/>\n\u6211\u8fd9\u4e2a\u535a\u5ba2\u5c31\u662f\u4f7f\u7528 WordPress \u90e8\u7f72\u7684\uff0c\u53bb\u5e74\u6691\u5047\u524d\u88ab\u5f53\u5730\u516c\u5b89\u5c40\u901a\u77e5\u5728 ICP \u5907\u6848\u540e\u8fd8\u8981\u8fdb\u884c\u516c\u5b89\u90e8\u5907\u6848\uff0c\u6211\u5f53\u65f6\u4ec5 ICP \u5907\u6848\u72b6\u6001\u7528\u4e86\u51e0\u5e74\u4e86\uff0c\u516c\u5b89\u90e8\u5907\u6848\u6211\u4e5f\u4e0d\u60f3\u641e\u4e86\u3002<br \/>\n\u6211\u5c31\u5728\u95f2\u9c7c\u627e\u4eba\u4e70\u4e86\u4e00\u4e2a\u963f\u91cc\u4e91\u8d26\u53f7\uff0c\u9644\u5e26\u5df2\u7ecf\u79df\u4e86\u4e00\u4e2a\u65b0\u52a0\u5761\u670d\u52a1\u5668\u4e00\u5e74\uff0c\u628a\u535a\u5ba2\u8fc1\u5230\u4e86\u8fd9\u4e2a\u65b0\u52a0\u5761\u670d\u52a1\u5668\uff08\u5927\u9646\u5916\u670d\u52a1\u5668\u4e0d\u9700\u8981\u5907\u6848\u4e5f\u80fd\u8bbf\u95ee\uff09\uff0c\u7136\u540e\u6211\u5c31\u628a ICP \u5907\u6848\u6ce8\u9500\u4e86\uff0c\u4e4b\u540e\u8f96\u533a\u6d3e\u51fa\u6240\u4e5f\u4e0d\u518d\u9a9a\u6270\u6211\u4e86\u3002\u5230\u4eca\u5e74\u6691\u5047\u670d\u52a1\u5668\u5c31\u5230\u671f\u4e86\uff0c\u4e0d\u8fc7\u6bcf\u6b21\u5230\u671f\u524d\u4e00\u4e2a\u6708\u963f\u91cc\u4e91\u4f1a\u7ed9\u6211\u53d1 10 \u5143\u4f18\u60e0\u5238\uff0c\u8fd9\u6837\u6211\u5c31\u53ef\u4ee5\u4ee5\u5b9e\u9645 22 \u5143\/\u6708 \u7684\u4ef7\u683c\u7eed\u79df\uff0c\u73b0\u5728\u8fd8\u5269\u5341\u51e0\u5929\uff0c\u963f\u91cc\u4e91\u90fd\u6ca1\u7ed9\u6211\u53d1\u4f18\u60e0\u5238\uff0c\u6211\u5c31\u4e0d\u6253\u7b97\u7eed\u8d39\u4e86\u3002<br \/>\n\u8fd9\u6b21\u6211\u53bb\u95f2\u9c7c\u627e\u4e86\u4e00\u5bb6\uff0c\u9644\u5e26\u5e73\u53f0\u8d26\u53f7\uff0c488\u5143\/2\u5e74\u4e70\u4e0b\uff0c\u5e73\u5747\u4e0b\u6765 20.3\u5143\/\u6708\u3002\u4e4b\u524d\u79df\u7684\u670d\u52a1\u5668\u662f2\u68382G\u5185\u5b58\uff0c\u6211\u540c\u65f6\u5728\u670d\u52a1\u5668\u4e0a\u8fd8\u90e8\u7f72\u4e86\u522b\u7684\u670d\u52a1\uff0c2G\u5185\u5b58\u6bd4\u8f83\u5403\u7d27\u3002\u8fd9\u6b21\u79df\u7684\u670d\u52a1\u5668\u6709 4G \u5185\u5b58\uff0c\u5185\u5b58\u5c31\u6bd4\u8f83\u5145\u8db3\uff0c\u56e0\u6b64\u53ef\u4ee5\u8003\u8651\u4f7f\u7528 Redis \u5bf9\u8c61\u7f13\u5b58\uff0c\u8fdb\u4e00\u6b65\u4f18\u5316\u6027\u80fd\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E6%93%8D%E4%BD%9C\"><\/span>\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u6211\u8fd9\u91cc WordPress \u662f LNMP \u73af\u5883\u90e8\u7f72\u7684\uff0c\u670d\u52a1\u5668\u4f7f\u7528 Ubuntu 24.04 <\/p>\n<p>\u5b89\u88c5 Redis<\/p>\n<pre><code class=\"language-bash\">sudo apt install redis php-redis<\/code><\/pre>\n<p>Redis \u7684\u914d\u7f6e\u6587\u4ef6\u5728 \/etc\/redis\/redis.conf<br \/>\n\u9700\u8981\u4ee5 root \u7f16\u8f91<br \/>\n\u6211\u8bbe\u7f6e\u4e86\u5185\u5b58\u6700\u5927\u4f7f\u7528\u91cf\u548c\u6dd8\u6c70\u7b56\u7565<\/p>\n<p>\u6700\u5927\u4f7f\u7528\u5185\u5b58 512MB<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/12\/image-1765286164592.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 703px; --smush-placeholder-aspect-ratio: 703\/391;\" \/><\/p>\n<p>\u6dd8\u6c70\u7b56\u7565\u9ed8\u8ba4\u662f noeviction\uff0c\u4e5f\u5c31\u662f\u6301\u4e45\u5316\uff0c\u5982\u679c\u7f13\u5b58\u8fbe\u5230\u8bbe\u7f6e\u7684\u6700\u5927\u5185\u5b58\uff0c\u5219\u65e0\u6cd5\u5199\u5165\u65b0\u7684\u7f13\u5b58\uff0c\u53ea\u80fd\u8bfb\u53d6\u5df2\u7ecf\u7f13\u5b58\u7684\u5185\u5bb9<br \/>\n\u6211\u6539\u6210\u4e86 allkeys-lfu\uff0c\u5219\u8fbe\u5230\u6700\u5927\u5185\u5b58\u9650\u5236\u7684\u65f6\u5019\u4f1a\u5220\u6389\u4f7f\u7528\u9891\u7387\u6700\u4f4e\u7684\u7f13\u5b58\uff0c\u4ee5\u4fdd\u8bc1\u65b0\u7684\u5185\u5bb9\u5199\u5165<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/12\/image-1765286268469.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 740px; --smush-placeholder-aspect-ratio: 740\/324;\" \/><\/p>\n<p>\u6267\u884c\u547d\u4ee4\u91cd\u542f Redis<\/p>\n<pre><code class=\"language-bash\">sudo systemctl restart redis<\/code><\/pre>\n<p>WordPress \u5b89\u88c5\u63d2\u4ef6\uff1aRedis Object Cache<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/12\/image-1765286584846.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 578px; --smush-placeholder-aspect-ratio: 578\/339;\" \/><\/p>\n<p>\u542f\u7528\u63d2\u4ef6\uff0c\u8fdb\u5165\u8bbe\u7f6e\u9875\u9762\uff0c\u542f\u52a8\u5bf9\u8c61\u7f13\u5b58\u5c31\u53ef\u4ee5\u5f00\u59cb\u5de5\u4f5c\u4e86<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/12\/image-1765286625200.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 393px; --smush-placeholder-aspect-ratio: 393\/534;\" \/><\/p>\n<p>\u8bbf\u95ee\u8fc7\u7684\u5185\u5bb9\u4ece\u6570\u636e\u5e93\u8bfb\u51fa\u5c31\u4f1a\u653e\u8fdb\u5185\u5b58\uff0c\u4e0b\u6b21\u8bbf\u95ee\u5c31\u4e0d\u4f1a\u518d\u53bb\u8bfb\u53d6\u6570\u636e\u5e93\uff0c\u76f4\u63a5\u4ece\u5185\u5b58\u8fd4\u56de\uff0c\u63d0\u9ad8\u8bbf\u95ee\u6027\u80fd<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/12\/image-1765286687187.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 546px; --smush-placeholder-aspect-ratio: 546\/240;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 2025\/12\/9 \u6211\u8fd9\u4e2a\u535a\u5ba2\u5c31\u662f\u4f7f\u7528 WordPress \u90e8\u7f72\u7684\uff0c\u53bb\u5e74\u6691\u5047\u524d\u88ab\u5f53\u5730\u516c\u5b89\u5c40\u901a\u77e5\u5728 ICP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,598,595],"tags":[1912,1911,1907,1151,1909,1908,1891,1910],"class_list":["post-22960","post","type-post","status-publish","format-standard","hentry","category-all","category-linux","category-595","tag-cache","tag-object","tag-redis","tag-wordpress","tag-1909","tag-1908","tag-1891","tag-1910"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/22960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22960"}],"version-history":[{"count":3,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/22960\/revisions"}],"predecessor-version":[{"id":22968,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/22960\/revisions\/22968"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}