{"id":2440,"date":"2025-03-24T08:47:16","date_gmt":"2025-03-23T23:47:16","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=2440"},"modified":"2025-03-24T08:47:47","modified_gmt":"2025-03-23T23:47:47","slug":"%e3%80%90%e4%bf%9d%e5%ad%98%e7%89%88%e3%80%91php%e3%82%a8%e3%83%b3%e3%82%b8%e3%83%8b%e3%82%a2%e3%81%ae%e3%81%9f%e3%82%81%e3%81%aeredis%e5%ae%8c%e5%85%a8%e3%82%ac%e3%82%a4%e3%83%89%ef%bc%9a%e5%ae%9f","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=2440","title":{"rendered":"\u3010\u4fdd\u5b58\u7248\u3011PHP\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u305f\u3081\u306eRedis\u5b8c\u5168\u30ac\u30a4\u30c9\uff1a\u5b9f\u88c5\u304b\u3089\u904b\u7528\u307e\u306715\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8"},"content":{"rendered":"\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"\u76ee\u6b21\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">Redis\u3068\u306f\uff1aPHP\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u7acb\u3061\u6b62\u307e\u308b\u3079\u304d\u57fa\u790e\u77e5\u8b58<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">\u306a\u305cPHP\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067Redis\u304c\u91cd\u8981\u306a\u306e\u304b<\/a>      <\/li>      <li>        <a href=\"#i-2\">Redis\u304c\u89e3\u6c7a\u3059\u308b3\u3064\u306e\u4e3b\u8981\u306a\u8ab2\u984c<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-6\">\u5f93\u6765\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u624b\u6cd5\u3068\u306e\u6bd4\u8f03<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-7\">PHP \u3067\u306e Redis \u5b9f\u88c5\u30ac\u30a4\u30c9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-8\">PHPRedis \u3068 Predis \u306e\u9055\u3044\u3068\u9078\u629e<\/a>      <\/li>      <li>        <a href=\"#i-11\">\u958b\u767a\u74b0\u5883\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u624b\u9806<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-14\">\u57fa\u672c\u7684\u306aCRUD\u30aa\u30da\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u88c5\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-18\">\u5b9f\u8df5\u7684\u306aRedis\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u6d3b\u7528\u6cd5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-19\">\u6587\u5b57\u5217\u578b\u3092\u4f7f\u3063\u305f\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u5b9f\u88c5<\/a>      <\/li>      <li>        <a href=\"#i-22\">\u30ea\u30b9\u30c8\u578b\u306b\u3088\u308b\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc\u306e\u69cb\u7bc9<\/a>      <\/li>      <li>        <a href=\"#i-23\">\u30cf\u30c3\u30b7\u30e5\u578b\u3092\u4f7f\u3063\u305f\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30e5<\/a>      <\/li>      <li>        <a href=\"#i-24\">\u30c7\u30fc\u30bf\u69cb\u9020\u9078\u629e\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-25\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u30d2\u30f3\u30c8<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-26\">Redis\u306b\u3088\u308b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u5b9f\u8df5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-27\">\u6226\u7565\u7684\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u8a2d\u8a08\u3068\u5b9f\u88c5<\/a>      <\/li>      <li>        <a href=\"#i-30\">\u8907\u6570\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u3067\u306e\u7d99\u7d9a\u6027\u78ba\u4fdd<\/a>      <\/li>      <li>        <a href=\"#i-32\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-35\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-36\">\u672c\u756a\u74b0\u5883\u3067\u306eRedis\u904b\u7528\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-37\">\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u3068\u30a2\u30e9\u30fc\u30c8\u306e\u8a2d\u5b9a<\/a>      <\/li>      <li>        <a href=\"#i-39\">\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3068\u969c\u5bb3\u5fa9\u65e7\u306e\u624b\u9806<\/a>      <\/li>      <li>        <a href=\"#i-41\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u306e\u5b9f\u88c5\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-43\">\u904b\u7528\u7ba1\u7406\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-44\">\u5b9f\u88c5\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">Redis\u3068\u306f\uff1aPHP\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u7acb\u3061\u6b62\u307e\u308b\u3079\u304d\u57fa\u790e\u77e5\u8b58<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">\u306a\u305cPHP\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067Redis\u304c\u91cd\u8981\u306a\u306e\u304b<\/h3>\n\n\n\n<p>\u73fe\u4ee3\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u306f\u6700\u3082\u91cd\u8981\u306a\u8ab2\u984c\u306e\u4e00\u3064\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002PHP\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u304a\u3044\u3066\u3001Redis\u306f\u4ee5\u4e0b\u306e\u7406\u7531\u304b\u3089\u6975\u3081\u3066\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9ad8\u901f\u306a\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u306e\u5b9f\u73fe<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30b9\u30c8\u30a2\u3068\u3057\u3066\u306e\u7279\u6027\u3092\u6d3b\u304b\u3057\u3001\u30df\u30ea\u79d2\u5358\u4f4d\u306e\u5fdc\u7b54\u6642\u9593\u3092\u5b9f\u73fe<\/li>\n\n\n\n<li>\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3084\u30ad\u30e3\u30c3\u30b7\u30e5\u306a\u3069\u3001\u983b\u7e41\u306a\u30c7\u30fc\u30bf\u30a2\u30af\u30bb\u30b9\u3092\u9ad8\u901f\u5316<\/li>\n\n\n\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u8ca0\u8377\u3092\u5927\u5e45\u306b\u8efd\u6e1b<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u306e\u5411\u4e0a<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5206\u6563\u30b7\u30b9\u30c6\u30e0\u306b\u304a\u3051\u308b\u30c7\u30fc\u30bf\u5171\u6709\u306e\u52b9\u7387\u5316<\/li>\n\n\n\n<li>\u30de\u30eb\u30c1\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u3067\u306e\u6574\u5408\u6027\u7dad\u6301<\/li>\n\n\n\n<li>\u6c34\u5e73\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u306b\u304a\u3051\u308b\u91cd\u8981\u306a\u57fa\u76e4\u6280\u8853<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u51e6\u7406\u306e\u5b9f\u73fe<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>WebSocket\u3068\u306e\u4f75\u7528\u306b\u3088\u308b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c7\u30fc\u30bf\u66f4\u65b0<\/li>\n\n\n\n<li>\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc\u30b7\u30b9\u30c6\u30e0\u306e\u69cb\u7bc9<\/li>\n\n\n\n<li>\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306a\u3069\u306e\u975e\u540c\u671f\u51e6\u7406\u306e\u5b9f\u88c5<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">Redis\u304c\u89e3\u6c7a\u3059\u308b3\u3064\u306e\u4e3b\u8981\u306a\u8ab2\u984c<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-3\">1. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u30dc\u30c8\u30eb\u30cd\u30c3\u30af<\/h4>\n\n\n\n<p><strong>\u554f\u984c\u70b9\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u904e\u5ea6\u306a\u8ca0\u8377<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30af\u30a8\u30ea\u306e\u5b9f\u884c\u6642\u9593<\/li>\n\n\n\n<li>\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9<\/li>\n<\/ul>\n\n\n\n<p><strong>Redis\u306b\u3088\u308b\u89e3\u6c7a\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5f93\u6765\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a2\u30af\u30bb\u30b9\n$user = DB::table('users')-&gt;where('id', $id)-&gt;first(); \/\/ 100ms\n\n\/\/ Redis\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\n$user = Redis::get('user:' . $id); \/\/ 0.1ms\nif (!$user) {\n    $user = DB::table('users')-&gt;where('id', $id)-&gt;first();\n    Redis::set('user:' . $id, $user, 'EX', 3600);\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-4\">2. \u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u306e\u5236\u7d04<\/h4>\n\n\n\n<p><strong>\u554f\u984c\u70b9\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u5171\u6709<\/li>\n\n\n\n<li>\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u6574\u5408\u6027\u7dad\u6301<\/li>\n\n\n\n<li>\u540c\u6642\u30a2\u30af\u30bb\u30b9\u306e\u51e6\u7406<\/li>\n<\/ul>\n\n\n\n<p><strong>Redis\u306b\u3088\u308b\u89e3\u6c7a\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30bb\u30c3\u30b7\u30e7\u30f3\u8a2d\u5b9a\u3092Redis\u306b\u5909\u66f4\nini_set('session.save_handler', 'redis');\nini_set('session.save_path', 'tcp:\/\/redis-server:6379');\n\n\/\/ \u8907\u6570\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u306e\u30ed\u30c3\u30af\u7ba1\u7406\n$lock = Redis::setnx('lock:process', 1);\nif ($lock) {\n    Redis::expire('lock:process', 60);\n    \/\/ \u51e6\u7406\u306e\u5b9f\u884c\n    Redis::del('lock:process');\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-5\">3. \u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u7ba1\u7406<\/h4>\n\n\n\n<p><strong>\u554f\u984c\u70b9\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u30c7\u30fc\u30bf\u306e\u53d6\u308a\u6271\u3044<\/li>\n\n\n\n<li>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c7\u30fc\u30bf\u306e\u66f4\u65b0<\/li>\n\n\n\n<li>\u4e00\u6642\u7684\u306a\u30c7\u30fc\u30bf\u306e\u7ba1\u7406<\/li>\n<\/ul>\n\n\n\n<p><strong>Redis\u306b\u3088\u308b\u89e3\u6c7a\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30bd\u30fc\u30c8\u6e08\u307f\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3057\u305f\u30e9\u30f3\u30ad\u30f3\u30b0\u5b9f\u88c5\nRedis::zadd('ranking', 100, 'user1');\nRedis::zadd('ranking', 200, 'user2');\n$top_users = Redis::zrevrange('ranking', 0, 9); \/\/ \u4e0a\u4f4d10\u4ef6\u3092\u53d6\u5f97<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">\u5f93\u6765\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u624b\u6cd5\u3068\u306e\u6bd4\u8f03<\/h3>\n\n\n<div id=\"id-7d50ea90-0af2-47b1-be75-8f87f561fa2b\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6a5f\u80fd<\/th><th>Redis<\/th><th>Memcached<\/th><th>\u30d5\u30a1\u30a4\u30eb\u30ad\u30e3\u30c3\u30b7\u30e5<\/th><\/tr><\/thead><tbody><tr><td>\u30c7\u30fc\u30bf\u6c38\u7d9a\u5316<\/td><td>\u25cb<\/td><td>\u00d7<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30c7\u30fc\u30bf\u69cb\u9020<\/td><td>\u8907\u6570\u5bfe\u5fdc<\/td><td>\u6587\u5b57\u5217\u306e\u307f<\/td><td>\u5236\u9650\u3042\u308a<\/td><\/tr><tr><td>\u30a2\u30c8\u30df\u30c3\u30af\u64cd\u4f5c<\/td><td>\u25cb<\/td><td>\u9650\u5b9a\u7684<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/td><td>\u25cb<\/td><td>\u00d7<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30e1\u30e2\u30ea\u52b9\u7387<\/td><td>\u9ad8<\/td><td>\u6700\u9ad8<\/td><td>\u4f4e<\/td><\/tr><tr><td>\u904b\u7528\u6027<\/td><td>\u512a\u308c\u3066\u3044\u308b<\/td><td>\u826f\u597d<\/td><td>\u8981\u6539\u5584<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p><strong>Redis\u306e\u512a\u4f4d\u6027\uff1a<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u8c4a\u5bcc\u3055<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6587\u5b57\u5217\u3001\u30ea\u30b9\u30c8\u3001\u30bb\u30c3\u30c8\u3001\u30cf\u30c3\u30b7\u30e5\u3001\u30bd\u30fc\u30c8\u6e08\u307f\u30bb\u30c3\u30c8\u306a\u3069<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u305d\u306e\u307e\u307e\u4fdd\u5b58\u53ef\u80fd<\/li>\n\n\n\n<li>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30ed\u30b8\u30c3\u30af\u306e\u7c21\u7d20\u5316<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u904b\u7528\u9762\u3067\u306e\u5229\u70b9<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u306b\u3088\u308b\u5bb9\u6613\u306a\u76e3\u8996<\/li>\n\n\n\n<li>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3068\u5fa9\u5143\u306e\u5bb9\u6613\u3055<\/li>\n\n\n\n<li>\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306e\u30b5\u30dd\u30fc\u30c8<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u7279\u6027<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9\u306b\u3088\u308b\u4e88\u6e2c\u53ef\u80fd\u306a\u6027\u80fd<\/li>\n\n\n\n<li>\u4f4e\u30ec\u30a4\u30c6\u30f3\u30b7\u30fc<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u7ba1\u7406\u306e\u67d4\u8edf\u6027<\/li>\n<\/ul>\n\n\n\n<p>\u4ee5\u4e0a\u306e\u7279\u5fb4\u304b\u3089\u3001Redis\u306f\u73fe\u4ee3\u306ePHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u5358\u306a\u308b\u30ad\u30e3\u30c3\u30b7\u30e5\u30b7\u30b9\u30c6\u30e0\u4ee5\u4e0a\u306e\u4fa1\u5024\u3092\u63d0\u4f9b\u3059\u308b\u91cd\u8981\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u7279\u306b\u5927\u898f\u6a21\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30de\u30a4\u30af\u30ed\u30b5\u30fc\u30d3\u30b9\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306b\u304a\u3044\u3066\u3001\u305d\u306e\u771f\u4fa1\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-7\">PHP \u3067\u306e Redis \u5b9f\u88c5\u30ac\u30a4\u30c9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-8\">PHPRedis \u3068 Predis \u306e\u9055\u3044\u3068\u9078\u629e<\/h3>\n\n\n\n<p>PHP\u3067Redis\u3092\u4f7f\u7528\u3059\u308b\u969b\u3001\u4e3b\u306b\u300cPHPRedis\u300d\u3068\u300cPredis\u300d\u3068\u3044\u30462\u3064\u306e\u9078\u629e\u80a2\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u306e\u7279\u5fb4\u3092\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-9\">PHPRedis\uff08\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\uff09<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHPRedis\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n\/\/ $ pecl install redis\n\/\/ $ php --ini | grep php.ini  \/\/ php.ini\u306e\u5834\u6240\u78ba\u8a8d\n\/\/ php.ini\u306b extension=redis.so \u3092\u8ffd\u52a0<\/pre>\n\n\n\n<p><strong>\u30e1\u30ea\u30c3\u30c8\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30cd\u30a4\u30c6\u30a3\u30d6\u5b9f\u88c5\u306b\u3088\u308b\u9ad8\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316<\/li>\n\n\n\n<li>\u5168\u3066\u306eRedis\u30b3\u30de\u30f3\u30c9\u3092\u30b5\u30dd\u30fc\u30c8<\/li>\n<\/ul>\n\n\n\n<p><strong>\u30c7\u30e1\u30ea\u30c3\u30c8\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP\u306e\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5fc5\u8981<\/li>\n\n\n\n<li>\u30b5\u30fc\u30d0\u30fc\u7ba1\u7406\u6a29\u9650\u304c\u5fc5\u8981<\/li>\n\n\n\n<li>\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u6642\u306b\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u5fc5\u8981<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-10\">Predis\uff08Composer\u30d1\u30c3\u30b1\u30fc\u30b8\uff09<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Predis\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\ncomposer require predis\/predis<\/pre>\n\n\n\n<p><strong>\u30e1\u30ea\u30c3\u30c8\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pure PHP\u5b9f\u88c5\u3067\u74b0\u5883\u4f9d\u5b58\u304c\u5c11\u306a\u3044<\/li>\n\n\n\n<li>Composer\u3067\u306e\u5c0e\u5165\u304c\u5bb9\u6613<\/li>\n\n\n\n<li>\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u5145\u5b9f<\/li>\n<\/ul>\n\n\n\n<p><strong>\u30c7\u30e1\u30ea\u30c3\u30c8\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7d14PHP\u306b\u3088\u308b\u5b9f\u88c5\u306e\u305f\u3081\u3001\u82e5\u5e72\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u4f4e\u4e0b<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u304c\u6bd4\u8f03\u7684\u591a\u3044<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-11\">\u958b\u767a\u74b0\u5883\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u624b\u9806<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-12\">1. Docker\u74b0\u5883\u3067\u306e\u69cb\u7bc9<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># docker-compose.yml\nversion: '3'\nservices:\n  php:\n    build:\n      context: .\n      dockerfile: Dockerfile\n    volumes:\n      - .\/:\/var\/www\/html\n    depends_on:\n      - redis\n  redis:\n    image: redis:latest\n    ports:\n      - \"6379:6379\"\n    volumes:\n      - redis_data:\/data\n\nvolumes:\n  redis_data:<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Dockerfile\nFROM php:8.2-fpm\n\n# PHPRedis\u62e1\u5f35\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\nRUN pecl install redis &amp;&amp; docker-php-ext-enable redis\n\n# Composer\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\nCOPY --from=composer:latest \/usr\/bin\/composer \/usr\/bin\/composer\n\nWORKDIR \/var\/www\/html<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-13\">2. Redis\u63a5\u7d9a\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ config\/redis.php\nreturn [\n    'default' =&gt; [\n        'host' =&gt; env('REDIS_HOST', 'redis'),\n        'password' =&gt; env('REDIS_PASSWORD', null),\n        'port' =&gt; env('REDIS_PORT', 6379),\n        'database' =&gt; 0,\n        'read_timeout' =&gt; 60,\n        'connection_timeout' =&gt; 60,\n    ],\n];<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">\u57fa\u672c\u7684\u306aCRUD\u30aa\u30da\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u88c5\u65b9\u6cd5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-15\">1. \u63a5\u7d9a\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ RedisClient\u30af\u30e9\u30b9\u306e\u4f5c\u6210\nclass RedisClient {\n    private $redis;\n\n    public function __construct() {\n        try {\n            $this-&gt;redis = new Redis();\n            $this-&gt;redis-&gt;connect('redis', 6379);\n        } catch (RedisException $e) {\n            throw new Exception('Redis\u63a5\u7d9a\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n\n    \/\/ \u63a5\u7d9a\u30c6\u30b9\u30c8\u7528\u30e1\u30bd\u30c3\u30c9\n    public function ping() {\n        try {\n            return $this-&gt;redis-&gt;ping();\n        } catch (RedisException $e) {\n            throw new Exception('Ping\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-16\">2. \u57fa\u672c\u7684\u306aCRUD\u64cd\u4f5c<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisOperations {\n    private $redis;\n\n    public function __construct(Redis $redis) {\n        $this-&gt;redis = $redis;\n    }\n\n    \/\/ Create\n    public function set($key, $value, $expiration = null) {\n        try {\n            if ($expiration) {\n                return $this-&gt;redis-&gt;setex($key, $expiration, $value);\n            }\n            return $this-&gt;redis-&gt;set($key, $value);\n        } catch (RedisException $e) {\n            throw new Exception('\u30c7\u30fc\u30bf\u8a2d\u5b9a\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n\n    \/\/ Read\n    public function get($key) {\n        try {\n            $value = $this-&gt;redis-&gt;get($key);\n            if ($value === false &amp;&amp; !$this-&gt;redis-&gt;exists($key)) {\n                throw new Exception('\u30ad\u30fc\u304c\u5b58\u5728\u3057\u307e\u305b\u3093');\n            }\n            return $value;\n        } catch (RedisException $e) {\n            throw new Exception('\u30c7\u30fc\u30bf\u53d6\u5f97\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n\n    \/\/ Update\n    public function update($key, $value) {\n        try {\n            if (!$this-&gt;redis-&gt;exists($key)) {\n                throw new Exception('\u66f4\u65b0\u5bfe\u8c61\u306e\u30ad\u30fc\u304c\u5b58\u5728\u3057\u307e\u305b\u3093');\n            }\n            return $this-&gt;redis-&gt;set($key, $value);\n        } catch (RedisException $e) {\n            throw new Exception('\u30c7\u30fc\u30bf\u66f4\u65b0\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n\n    \/\/ Delete\n    public function delete($key) {\n        try {\n            $result = $this-&gt;redis-&gt;del($key);\n            if ($result === 0) {\n                throw new Exception('\u524a\u9664\u5bfe\u8c61\u306e\u30ad\u30fc\u304c\u5b58\u5728\u3057\u307e\u305b\u3093');\n            }\n            return true;\n        } catch (RedisException $e) {\n            throw new Exception('\u30c7\u30fc\u30bf\u524a\u9664\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n\n    \/\/ \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306e\u4f8b\n    public function atomicOperation() {\n        try {\n            $this-&gt;redis-&gt;multi();\n            $this-&gt;redis-&gt;set('key1', 'value1');\n            $this-&gt;redis-&gt;set('key2', 'value2');\n            return $this-&gt;redis-&gt;exec();\n        } catch (RedisException $e) {\n            $this-&gt;redis-&gt;discard();\n            throw new Exception('\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc: ' . $e-&gt;getMessage());\n        }\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-17\">3. \u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u4f7f\u7528\u4f8b\ntry {\n    $client = new RedisClient();\n    $operations = new RedisOperations($client-&gt;getRedis());\n\n    \/\/ \u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\n    $operations-&gt;set('session:user:123', json_encode([\n        'id' =&gt; 123,\n        'name' =&gt; 'John Doe',\n        'last_access' =&gt; time()\n    ]), 3600); \/\/ 1\u6642\u9593\u306e\u6709\u52b9\u671f\u9650\n\n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\n    $userData = json_decode($operations-&gt;get('session:user:123'), true);\n\n    \/\/ \u30c7\u30fc\u30bf\u306e\u66f4\u65b0\n    $userData['last_access'] = time();\n    $operations-&gt;update('session:user:123', json_encode($userData));\n\n    \/\/ \u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u524a\u9664\n    $operations-&gt;delete('session:user:123');\n\n} catch (Exception $e) {\n    \/\/ \u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u8a18\u9332\n    error_log($e-&gt;getMessage());\n    \/\/ \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\n}<\/pre>\n\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u4f8b\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u9069\u5207\u306a\u5b9f\u88c5<\/li>\n\n\n\n<li>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306e\u30b5\u30dd\u30fc\u30c8<\/li>\n\n\n\n<li>\u6709\u52b9\u671f\u9650\u4ed8\u304d\u30c7\u30fc\u30bf\u306e\u7ba1\u7406<\/li>\n\n\n\n<li>JSON\u5f62\u5f0f\u3067\u306e\u30c7\u30fc\u30bf\u4fdd\u5b58<\/li>\n\n\n\n<li>\u30af\u30ea\u30fc\u30f3\u306a\u30af\u30e9\u30b9\u8a2d\u8a08<\/li>\n<\/ul>\n\n\n\n<p>\u672c\u756a\u74b0\u5883\u3067\u306e\u4f7f\u7528\u306b\u5411\u3051\u3066\u3001\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u63a5\u7d9a\u30a8\u30e9\u30fc\u306e\u9069\u5207\u306a\u51e6\u7406<\/li>\n\n\n\n<li>\u30ad\u30fc\u540d\u306e\u547d\u540d\u898f\u5247\u306e\u7d71\u4e00<\/li>\n\n\n\n<li>\u30c7\u30fc\u30bf\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u65b9\u5f0f\u306e\u691c\u8a0e<\/li>\n\n\n\n<li>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306e\u9069\u5207\u306a\u4f7f\u7528<\/li>\n\n\n\n<li>\u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u7ba1\u7406<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-18\">\u5b9f\u8df5\u7684\u306aRedis\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u6d3b\u7528\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">\u6587\u5b57\u5217\u578b\u3092\u4f7f\u3063\u305f\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u91cd\u8981\u306a\u6a5f\u80fd\u306e\u4e00\u3064\u3067\u3059\u3002Redis\u306e\u6587\u5b57\u5217\u578b\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u9ad8\u901f\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-20\">\u30bb\u30c3\u30b7\u30e7\u30f3\u30cf\u30f3\u30c9\u30e9\u30fc\u306e\u5b9f\u88c5<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisSessionHandler implements SessionHandlerInterface\n{\n    private $redis;\n    private $prefix;\n    private $ttl;\n\n    public function __construct(Redis $redis, string $prefix = 'session:', int $ttl = 3600)\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;prefix = $prefix;\n        $this-&gt;ttl = $ttl;\n    }\n\n    public function open($path, $name): bool\n    {\n        return true;\n    }\n\n    public function close(): bool\n    {\n        return true;\n    }\n\n    public function read($id): string\n    {\n        $data = $this-&gt;redis-&gt;get($this-&gt;prefix . $id);\n        return $data === false ? '' : $data;\n    }\n\n    public function write($id, $data): bool\n    {\n        return $this-&gt;redis-&gt;setex($this-&gt;prefix . $id, $this-&gt;ttl, $data);\n    }\n\n    public function destroy($id): bool\n    {\n        $this-&gt;redis-&gt;del($this-&gt;prefix . $id);\n        return true;\n    }\n\n    public function gc($max_lifetime): bool\n    {\n        return true; \/\/ Redis\u304c\u81ea\u52d5\u7684\u306b\u671f\u9650\u5207\u308c\u306e\u30ad\u30fc\u3092\u524a\u9664\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-21\">\u30bb\u30c3\u30b7\u30e7\u30f3\u30cf\u30f3\u30c9\u30e9\u30fc\u306e\u4f7f\u7528\u4f8b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30bb\u30c3\u30b7\u30e7\u30f3\u30cf\u30f3\u30c9\u30e9\u30fc\u306e\u767b\u9332\n$redis = new Redis();\n$redis-&gt;connect('localhost', 6379);\n$handler = new RedisSessionHandler($redis);\nsession_set_save_handler($handler, true);\nsession_start();\n\n\/\/ \u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u4f7f\u7528\n$_SESSION['user_id'] = 123;\n$_SESSION['last_access'] = time();<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">\u30ea\u30b9\u30c8\u578b\u306b\u3088\u308b\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc\u306e\u69cb\u7bc9<\/h3>\n\n\n\n<p>\u975e\u540c\u671f\u51e6\u7406\u3092\u5b9f\u73fe\u3059\u308b\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc\u30b7\u30b9\u30c6\u30e0\u306f\u3001Redis\u306e\u30ea\u30b9\u30c8\u578b\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u52b9\u7387\u7684\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisJobQueue\n{\n    private $redis;\n    private $queueKey;\n\n    public function __construct(Redis $redis, string $queueKey = 'job_queue')\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;queueKey = $queueKey;\n    }\n\n    \/\/ \u30b8\u30e7\u30d6\u306e\u8ffd\u52a0\n    public function enqueue(array $job): bool\n    {\n        try {\n            $jobData = json_encode($job);\n            return $this-&gt;redis-&gt;lPush($this-&gt;queueKey, $jobData) &gt; 0;\n        } catch (Exception $e) {\n            error_log('Job enqueue error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u30b8\u30e7\u30d6\u306e\u53d6\u5f97\n    public function dequeue(): ?array\n    {\n        try {\n            $jobData = $this-&gt;redis-&gt;rPop($this-&gt;queueKey);\n            return $jobData ? json_decode($jobData, true) : null;\n        } catch (Exception $e) {\n            error_log('Job dequeue error: ' . $e-&gt;getMessage());\n            return null;\n        }\n    }\n\n    \/\/ \u30ad\u30e5\u30fc\u306e\u9577\u3055\u3092\u53d6\u5f97\n    public function getQueueLength(): int\n    {\n        return $this-&gt;redis-&gt;lLen($this-&gt;queueKey);\n    }\n}\n\n\/\/ \u30ef\u30fc\u30ab\u30fc\u30d7\u30ed\u30bb\u30b9\u306e\u5b9f\u88c5\u4f8b\nclass JobWorker\n{\n    private $queue;\n    private $maxJobs;\n    private $sleep;\n\n    public function __construct(RedisJobQueue $queue, int $maxJobs = 100, int $sleep = 5)\n    {\n        $this-&gt;queue = $queue;\n        $this-&gt;maxJobs = $maxJobs;\n        $this-&gt;sleep = $sleep;\n    }\n\n    public function run(): void\n    {\n        $processedJobs = 0;\n\n        while ($processedJobs &lt; $this-&gt;maxJobs) {\n            $job = $this-&gt;queue-&gt;dequeue();\n\n            if ($job === null) {\n                sleep($this-&gt;sleep);\n                continue;\n            }\n\n            try {\n                $this-&gt;processJob($job);\n                $processedJobs++;\n            } catch (Exception $e) {\n                error_log('Job processing error: ' . $e-&gt;getMessage());\n            }\n        }\n    }\n\n    private function processJob(array $job): void\n    {\n        \/\/ \u30b8\u30e7\u30d6\u51e6\u7406\u306e\u30ed\u30b8\u30c3\u30af\u3092\u5b9f\u88c5\n        switch ($job['type']) {\n            case 'email':\n                \/\/ \u30e1\u30fc\u30eb\u9001\u4fe1\u51e6\u7406\n                break;\n            case 'report':\n                \/\/ \u30ec\u30dd\u30fc\u30c8\u751f\u6210\u51e6\u7406\n                break;\n            default:\n                throw new Exception('Unknown job type');\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">\u30cf\u30c3\u30b7\u30e5\u578b\u3092\u4f7f\u3063\u305f\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30e5<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u3088\u3046\u306a\u69cb\u9020\u5316\u30c7\u30fc\u30bf\u306f\u3001Redis\u306e\u30cf\u30c3\u30b7\u30e5\u578b\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u52b9\u7387\u7684\u306b\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class UserCache\n{\n    private $redis;\n    private $prefix;\n    private $ttl;\n\n    public function __construct(Redis $redis, string $prefix = 'user:', int $ttl = 3600)\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;prefix = $prefix;\n        $this-&gt;ttl = $ttl;\n    }\n\n    \/\/ \u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n    public function cacheUser(int $userId, array $userData): bool\n    {\n        $key = $this-&gt;prefix . $userId;\n\n        try {\n            \/\/ \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u958b\u59cb\n            $this-&gt;redis-&gt;multi();\n\n            \/\/ \u30cf\u30c3\u30b7\u30e5\u30c7\u30fc\u30bf\u306e\u8a2d\u5b9a\n            $this-&gt;redis-&gt;hMset($key, $userData);\n\n            \/\/ \u6709\u52b9\u671f\u9650\u306e\u8a2d\u5b9a\n            $this-&gt;redis-&gt;expire($key, $this-&gt;ttl);\n\n            \/\/ \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5b9f\u884c\n            $this-&gt;redis-&gt;exec();\n\n            return true;\n        } catch (Exception $e) {\n            $this-&gt;redis-&gt;discard();\n            error_log('User cache error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u7279\u5b9a\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u53d6\u5f97\n    public function getUserField(int $userId, string $field)\n    {\n        return $this-&gt;redis-&gt;hGet($this-&gt;prefix . $userId, $field);\n    }\n\n    \/\/ \u5168\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u53d6\u5f97\n    public function getUser(int $userId): ?array\n    {\n        $data = $this-&gt;redis-&gt;hGetAll($this-&gt;prefix . $userId);\n        return $data ?: null;\n    }\n\n    \/\/ \u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u66f4\u65b0\n    public function updateUserField(int $userId, string $field, $value): bool\n    {\n        try {\n            return $this-&gt;redis-&gt;hSet($this-&gt;prefix . $userId, $field, $value) !== false;\n        } catch (Exception $e) {\n            error_log('Field update error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$userCache = new UserCache($redis);\n\n\/\/ \u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n$userData = [\n    'name' =&gt; 'John Doe',\n    'email' =&gt; 'john@example.com',\n    'last_login' =&gt; time()\n];\n$userCache-&gt;cacheUser(123, $userData);\n\n\/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u30e6\u30fc\u30b6\u30fc\u540d\u3092\u53d6\u5f97\n$userName = $userCache-&gt;getUserField(123, 'name');\n\n\/\/ \u6700\u7d42\u30ed\u30b0\u30a4\u30f3\u6642\u9593\u306e\u66f4\u65b0\n$userCache-&gt;updateUserField(123, 'last_login', time());<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-24\">\u30c7\u30fc\u30bf\u69cb\u9020\u9078\u629e\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6587\u5b57\u5217\u578b\u306e\u4f7f\u7528\u5834\u9762<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b7\u30f3\u30d7\u30eb\u306a\u30ad\u30fc\u30fb\u30d0\u30ea\u30e5\u30fc\u306e\u4fdd\u5b58<\/li>\n\n\n\n<li>\u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf<\/li>\n\n\n\n<li>\u30ad\u30e3\u30c3\u30b7\u30e5\u30c7\u30fc\u30bf\uff08\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30ea\u30b9\u30c8\u578b\u306e\u4f7f\u7528\u5834\u9762<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc<\/li>\n\n\n\n<li>\u6700\u65b0\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u30ed\u30b0<\/li>\n\n\n\n<li>\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u6a5f\u80fd<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30cf\u30c3\u30b7\u30e5\u578b\u306e\u4f7f\u7528\u5834\u9762<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e6\u30fc\u30b6\u30fc\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u60c5\u5831<\/li>\n\n\n\n<li>\u95a2\u9023\u30c7\u30fc\u30bf\u306e\u30b0\u30eb\u30fc\u30d7\u5316<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30bb\u30c3\u30c8\u578b\u306e\u4f7f\u7528\u5834\u9762<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e6\u30cb\u30fc\u30af\u306a\u5024\u306e\u96c6\u5408<\/li>\n\n\n\n<li>\u30bf\u30b0\u30b7\u30b9\u30c6\u30e0<\/li>\n\n\n\n<li>\u30d5\u30a9\u30ed\u30ef\u30fc\/\u30d5\u30a9\u30ed\u30fc\u95a2\u4fc2<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30bd\u30fc\u30c8\u6e08\u307f\u30bb\u30c3\u30c8\u578b\u306e\u4f7f\u7528\u5834\u9762<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e9\u30f3\u30ad\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0<\/li>\n\n\n\n<li>\u30ec\u30fc\u30c8\u30ea\u30df\u30c3\u30c8<\/li>\n\n\n\n<li>\u512a\u5148\u9806\u4f4d\u4ed8\u304d\u30ad\u30e5\u30fc<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-25\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u30d2\u30f3\u30c8<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9069\u5207\u306a\u30ad\u30fc\u8a2d\u8a08<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u610f\u5473\u306e\u3042\u308b\u547d\u540d\u898f\u5247<\/li>\n\n\n\n<li>\u30ad\u30fc\u306e\u9577\u3055\u3092\u9069\u5207\u306b\u4fdd\u3064<\/li>\n\n\n\n<li>\u968e\u5c64\u69cb\u9020\u3092\u8868\u73fe\u3059\u308b\u533a\u5207\u308a\u6587\u5b57\u306e\u7d71\u4e00<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e0d\u8981\u306a\u30c7\u30fc\u30bf\u306e\u524a\u9664<\/li>\n\n\n\n<li>\u9069\u5207\u306aTTL\u306e\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u5927\u304d\u306a\u30c7\u30fc\u30bf\u306e\u5206\u5272\u7ba1\u7406<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d0\u30c3\u30c1\u51e6\u7406\u306e\u6d3b\u7528<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306e\u4f7f\u7528<\/li>\n\n\n\n<li>\u30de\u30eb\u30c1\u30b3\u30de\u30f3\u30c9\u306e\u6d3b\u7528<\/li>\n\n\n\n<li>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u9069\u5207\u306a\u4f7f\u7528<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-26\">Redis\u306b\u3088\u308b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u5b9f\u8df5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-27\">\u6226\u7565\u7684\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u8a2d\u8a08\u3068\u5b9f\u88c5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-28\">1. \u30ad\u30e3\u30c3\u30b7\u30e5\u6226\u7565\u306e\u9078\u629e<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class CacheStrategy\n{\n    private $redis;\n    private $prefix;\n\n    public function __construct(Redis $redis, string $prefix = 'cache:')\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;prefix = $prefix;\n    }\n\n    \/\/ Write-Through \u30ad\u30e3\u30c3\u30b7\u30e5\u30d1\u30bf\u30fc\u30f3\n    public function writeThrough(string $key, $data, callable $dbWriter): bool\n    {\n        try {\n            \/\/ DB\u3078\u306e\u66f8\u304d\u8fbc\u307f\n            $dbWriter($data);\n\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u66f4\u65b0\n            return $this-&gt;redis-&gt;set($this-&gt;prefix . $key, serialize($data));\n        } catch (Exception $e) {\n            error_log('Write-through cache error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ Write-Back \u30ad\u30e3\u30c3\u30b7\u30e5\u30d1\u30bf\u30fc\u30f3\n    public function writeBack(string $key, $data): bool\n    {\n        try {\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u66f8\u304d\u8fbc\u307f\n            $this-&gt;redis-&gt;set($this-&gt;prefix . $key, serialize($data));\n\n            \/\/ \u975e\u540c\u671f\u3067DB\u306b\u66f8\u304d\u8fbc\u3080\u3088\u3046\u306b\u30ad\u30e5\u30fc\u306b\u8ffd\u52a0\n            return $this-&gt;queueDatabaseWrite($key, $data);\n        } catch (Exception $e) {\n            error_log('Write-back cache error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ Cache-Aside \u30d1\u30bf\u30fc\u30f3\n    public function cacheAside(string $key, callable $dbFetcher)\n    {\n        try {\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u53d6\u5f97\n            $data = $this-&gt;redis-&gt;get($this-&gt;prefix . $key);\n\n            if ($data === false) {\n                \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30df\u30b9\u6642\u306fDB\u304b\u3089\u53d6\u5f97\n                $data = $dbFetcher();\n                if ($data !== null) {\n                    $this-&gt;redis-&gt;set($this-&gt;prefix . $key, serialize($data));\n                }\n            } else {\n                $data = unserialize($data);\n            }\n\n            return $data;\n        } catch (Exception $e) {\n            error_log('Cache-aside error: ' . $e-&gt;getMessage());\n            return null;\n        }\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-29\">2. \u52b9\u7387\u7684\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u5b9f\u88c5<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class PerformanceCache\n{\n    private $redis;\n    private $strategy;\n\n    public function __construct(Redis $redis)\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;strategy = new CacheStrategy($redis);\n    }\n\n    \/\/ \u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u305f\u4e00\u62ec\u51e6\u7406\n    public function bulkCacheUpdate(array $data): bool\n    {\n        try {\n            $pipe = $this-&gt;redis-&gt;multi(Redis::PIPELINE);\n\n            foreach ($data as $key =&gt; $value) {\n                $pipe-&gt;set(\"cache:$key\", serialize($value));\n            }\n\n            $results = $pipe-&gt;exec();\n            return !in_array(false, $results, true);\n        } catch (Exception $e) {\n            error_log('Bulk cache update error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ LRU\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u5b9f\u88c5\n    public function lruCache(string $key, callable $fetcher, int $maxSize = 1000): mixed\n    {\n        try {\n            $value = $this-&gt;redis-&gt;get(\"cache:$key\");\n\n            if ($value === false) {\n                $value = $fetcher();\n\n                \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30b5\u30a4\u30ba\u306e\u30c1\u30a7\u30c3\u30af\u3068\u53e4\u3044\u30c7\u30fc\u30bf\u306e\u524a\u9664\n                if ($this-&gt;redis-&gt;dbSize() &gt;= $maxSize) {\n                    $this-&gt;evictOldestEntry();\n                }\n\n                $this-&gt;redis-&gt;set(\"cache:$key\", serialize($value));\n                $this-&gt;redis-&gt;zAdd('cache:access', time(), $key);\n            } else {\n                $this-&gt;redis-&gt;zAdd('cache:access', time(), $key);\n                $value = unserialize($value);\n            }\n\n            return $value;\n        } catch (Exception $e) {\n            error_log('LRU cache error: ' . $e-&gt;getMessage());\n            return null;\n        }\n    }\n\n    private function evictOldestEntry(): void\n    {\n        $oldest = $this-&gt;redis-&gt;zRange('cache:access', 0, 0)[0] ?? null;\n        if ($oldest) {\n            $this-&gt;redis-&gt;del(\"cache:$oldest\");\n            $this-&gt;redis-&gt;zRem('cache:access', $oldest);\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-30\">\u8907\u6570\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u3067\u306e\u7d99\u7d9a\u6027\u78ba\u4fdd<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-31\">1. \u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisReplication\n{\n    private $master;\n    private $slaves;\n\n    public function __construct(Redis $master, array $slaves)\n    {\n        $this-&gt;master = $master;\n        $this-&gt;slaves = $slaves;\n    }\n\n    \/\/ \u8aad\u307f\u53d6\u308a\u64cd\u4f5c\u306e\u5206\u6563\n    public function read(string $key)\n    {\n        \/\/ \u30e9\u30f3\u30c0\u30e0\u306b\u30b9\u30ec\u30fc\u30d6\u3092\u9078\u629e\n        $slave = $this-&gt;slaves[array_rand($this-&gt;slaves)];\n\n        try {\n            $value = $slave-&gt;get($key);\n            if ($value === false) {\n                \/\/ \u30b9\u30ec\u30fc\u30d6\u3067\u5931\u6557\u3057\u305f\u5834\u5408\u306f\u30de\u30b9\u30bf\u30fc\u304b\u3089\u8aad\u307f\u53d6\u308a\n                $value = $this-&gt;master-&gt;get($key);\n            }\n            return $value;\n        } catch (Exception $e) {\n            error_log('Replication read error: ' . $e-&gt;getMessage());\n            return null;\n        }\n    }\n\n    \/\/ \u66f8\u304d\u8fbc\u307f\u64cd\u4f5c\uff08\u30de\u30b9\u30bf\u30fc\u306e\u307f\uff09\n    public function write(string $key, $value): bool\n    {\n        try {\n            return $this-&gt;master-&gt;set($key, $value);\n        } catch (Exception $e) {\n            error_log('Replication write error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-32\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-33\">1. \u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisMemoryMonitor\n{\n    private $redis;\n\n    public function __construct(Redis $redis)\n    {\n        $this-&gt;redis = $redis;\n    }\n\n    \/\/ \u30e1\u30e2\u30ea\u4f7f\u7528\u72b6\u6cc1\u306e\u53d6\u5f97\n    public function getMemoryStats(): array\n    {\n        try {\n            $info = $this-&gt;redis-&gt;info('memory');\n            return [\n                'used_memory' =&gt; $info['used_memory_human'],\n                'used_memory_peak' =&gt; $info['used_memory_peak_human'],\n                'used_memory_lua' =&gt; $info['used_memory_lua_human'],\n                'memory_fragmentation_ratio' =&gt; $info['mem_fragmentation_ratio']\n            ];\n        } catch (Exception $e) {\n            error_log('Memory monitoring error: ' . $e-&gt;getMessage());\n            return [];\n        }\n    }\n\n    \/\/ \u5927\u304d\u306a\u30ad\u30fc\u306e\u7279\u5b9a\n    public function findLargeKeys(int $minSize = 1000): array\n    {\n        $largeKeys = [];\n        $iterator = null;\n\n        try {\n            do {\n                $keys = $this-&gt;redis-&gt;scan($iterator, '*', 100);\n                if ($keys) {\n                    foreach ($keys as $key) {\n                        $size = $this-&gt;redis-&gt;strlen($key);\n                        if ($size &gt;= $minSize) {\n                            $largeKeys[$key] = $size;\n                        }\n                    }\n                }\n            } while ($iterator &gt; 0);\n\n            return $largeKeys;\n        } catch (Exception $e) {\n            error_log('Large keys scan error: ' . $e-&gt;getMessage());\n            return [];\n        }\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-34\">2. \u30e1\u30e2\u30ea\u6700\u9069\u5316\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class MemoryOptimizer\n{\n    private $redis;\n\n    public function __construct(Redis $redis)\n    {\n        $this-&gt;redis = $redis;\n    }\n\n    \/\/ \u6709\u52b9\u671f\u9650\u5207\u308c\u30ad\u30fc\u306e\u81ea\u52d5\u524a\u9664\u8a2d\u5b9a\n    public function configureExpiration(): bool\n    {\n        try {\n            \/\/ volatile-lru\u306e\u8a2d\u5b9a\n            $this-&gt;redis-&gt;config('SET', 'maxmemory-policy', 'volatile-lru');\n            \/\/ \u6700\u5927\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u8a2d\u5b9a\n            return $this-&gt;redis-&gt;config('SET', 'maxmemory', '1gb');\n        } catch (Exception $e) {\n            error_log('Expiration configuration error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u30c7\u30fc\u30bf\u5727\u7e2e\u306e\u5b9f\u88c5\n    public function compressAndStore(string $key, $data): bool\n    {\n        try {\n            $compressed = gzcompress(serialize($data));\n            return $this-&gt;redis-&gt;set($key, $compressed);\n        } catch (Exception $e) {\n            error_log('Data compression error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u5727\u7e2e\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\n    public function getAndDecompress(string $key)\n    {\n        try {\n            $data = $this-&gt;redis-&gt;get($key);\n            if ($data === false) {\n                return null;\n            }\n            return unserialize(gzuncompress($data));\n        } catch (Exception $e) {\n            error_log('Data decompression error: ' . $e-&gt;getMessage());\n            return null;\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-35\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30e5\u6226\u7565<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9069\u5207\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u30d1\u30bf\u30fc\u30f3\u306e\u9078\u629e<\/li>\n\n\n\n<li>\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u6709\u52b9\u671f\u9650\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u66f4\u65b0\u983b\u5ea6\u306e\u6700\u9069\u5316<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e1\u30e2\u30ea\u7ba1\u7406<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u5b9a\u671f\u7684\u306a\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0<\/li>\n\n\n\n<li>\u5927\u304d\u306a\u30ad\u30fc\u306e\u7279\u5b9a\u3068\u6700\u9069\u5316<\/li>\n\n\n\n<li>\u9069\u5207\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u9078\u629e<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30de\u30b9\u30bf\u30fc\/\u30b9\u30ec\u30fc\u30d6\u306e\u9069\u5207\u306a\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u8aad\u307f\u53d6\u308a\u64cd\u4f5c\u306e\u5206\u6563<\/li>\n\n\n\n<li>\u30d5\u30a7\u30a4\u30eb\u30aa\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30ec\u30a4\u30c6\u30f3\u30b7\u30fc\u306e\u76e3\u8996<\/li>\n\n\n\n<li>\u30d2\u30c3\u30c8\u7387\u306e\u8a08\u6e2c<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u65ad\u7247\u5316\u306e\u76e3\u8996<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u5207\u306b\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001Redis\u3092\u4f7f\u7528\u3057\u305fPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6027\u80fd\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-36\">\u672c\u756a\u74b0\u5883\u3067\u306eRedis\u904b\u7528\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-37\">\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u3068\u30a2\u30e9\u30fc\u30c8\u306e\u8a2d\u5b9a<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-38\">1. \u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306e\u5b9f\u88c5<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisMonitor\n{\n    private $redis;\n    private $alertThresholds;\n\n    public function __construct(Redis $redis, array $alertThresholds = [])\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;alertThresholds = array_merge([\n            'memory_usage' =&gt; 80, \/\/ \u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u306e\u3057\u304d\u3044\u5024\uff08%\uff09\n            'connected_clients' =&gt; 5000, \/\/ \u6700\u5927\u63a5\u7d9a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u6570\n            'response_time' =&gt; 100, \/\/ \u6700\u5927\u5fdc\u7b54\u6642\u9593\uff08\u30df\u30ea\u79d2\uff09\n        ], $alertThresholds);\n    }\n\n    \/\/ \u30b7\u30b9\u30c6\u30e0\u72b6\u614b\u306e\u5305\u62ec\u7684\u306a\u30c1\u30a7\u30c3\u30af\n    public function checkSystemHealth(): array\n    {\n        try {\n            $info = $this-&gt;redis-&gt;info();\n            $status = [\n                'memory_usage' =&gt; $this-&gt;checkMemoryUsage($info),\n                'client_connections' =&gt; $this-&gt;checkClientConnections($info),\n                'response_time' =&gt; $this-&gt;checkResponseTime(),\n                'replication_status' =&gt; $this-&gt;checkReplicationStatus($info),\n            ];\n\n            return array_filter($status);\n        } catch (Exception $e) {\n            error_log('System health check error: ' . $e-&gt;getMessage());\n            return ['error' =&gt; $e-&gt;getMessage()];\n        }\n    }\n\n    \/\/ \u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u306e\u30c1\u30a7\u30c3\u30af\n    private function checkMemoryUsage(array $info): ?array\n    {\n        $maxMemory = $info['maxmemory'];\n        $usedMemory = $info['used_memory'];\n        $usagePercent = ($usedMemory \/ $maxMemory) * 100;\n\n        if ($usagePercent &gt;= $this-&gt;alertThresholds['memory_usage']) {\n            return [\n                'status' =&gt; 'warning',\n                'message' =&gt; \"High memory usage: {$usagePercent}%\",\n                'current' =&gt; $usedMemory,\n                'max' =&gt; $maxMemory\n            ];\n        }\n\n        return null;\n    }\n\n    \/\/ \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u63a5\u7d9a\u6570\u306e\u30c1\u30a7\u30c3\u30af\n    private function checkClientConnections(array $info): ?array\n    {\n        $connectedClients = $info['connected_clients'];\n\n        if ($connectedClients &gt;= $this-&gt;alertThresholds['connected_clients']) {\n            return [\n                'status' =&gt; 'warning',\n                'message' =&gt; \"High number of connected clients: {$connectedClients}\",\n                'current' =&gt; $connectedClients,\n                'max' =&gt; $this-&gt;alertThresholds['connected_clients']\n            ];\n        }\n\n        return null;\n    }\n\n    \/\/ \u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u72b6\u614b\u306e\u30c1\u30a7\u30c3\u30af\n    private function checkReplicationStatus(array $info): ?array\n    {\n        if (isset($info['role']) &amp;&amp; $info['role'] === 'slave') {\n            $lag = $info['master_last_io_seconds_ago'];\n\n            if ($lag &gt; 60) { \/\/ 1\u5206\u4ee5\u4e0a\u306e\u9045\u5ef6\n                return [\n                    'status' =&gt; 'warning',\n                    'message' =&gt; \"High replication lag: {$lag} seconds\",\n                    'current' =&gt; $lag\n                ];\n            }\n        }\n\n        return null;\n    }\n\n    \/\/ \u5fdc\u7b54\u6642\u9593\u306e\u30c1\u30a7\u30c3\u30af\n    private function checkResponseTime(): ?array\n    {\n        $start = microtime(true);\n        $this-&gt;redis-&gt;ping();\n        $responseTime = (microtime(true) - $start) * 1000;\n\n        if ($responseTime &gt;= $this-&gt;alertThresholds['response_time']) {\n            return [\n                'status' =&gt; 'warning',\n                'message' =&gt; \"High response time: {$responseTime}ms\",\n                'current' =&gt; $responseTime,\n                'max' =&gt; $this-&gt;alertThresholds['response_time']\n            ];\n        }\n\n        return null;\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-39\">\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3068\u969c\u5bb3\u5fa9\u65e7\u306e\u624b\u9806<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-40\">1. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30b7\u30b9\u30c6\u30e0\u306e\u5b9f\u88c5<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisBackup\n{\n    private $redis;\n    private $backupPath;\n\n    public function __construct(Redis $redis, string $backupPath)\n    {\n        $this-&gt;redis = $redis;\n        $this-&gt;backupPath = $backupPath;\n    }\n\n    \/\/ RDB\u30d5\u30a1\u30a4\u30eb\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\n    public function createBackup(): bool\n    {\n        try {\n            \/\/ BGSAVE \u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\n            $this-&gt;redis-&gt;bgsave();\n\n            \/\/ \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u5b8c\u4e86\u3092\u5f85\u6a5f\n            while ($this-&gt;redis-&gt;info('persistence')['rdb_bgsave_in_progress']) {\n                sleep(1);\n            }\n\n            \/\/ \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30d4\u30fc\n            $timestamp = date('Y-m-d_H-i-s');\n            $source = $this-&gt;redis-&gt;config('GET', 'dir')['dir'] . '\/dump.rdb';\n            $destination = \"{$this-&gt;backupPath}\/redis_backup_{$timestamp}.rdb\";\n\n            return copy($source, $destination);\n        } catch (Exception $e) {\n            error_log('Backup creation error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ AOF\u30d5\u30a1\u30a4\u30eb\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\n    public function backupAOF(): bool\n    {\n        try {\n            $timestamp = date('Y-m-d_H-i-s');\n            $source = $this-&gt;redis-&gt;config('GET', 'appendfilename')['appendfilename'];\n            $destination = \"{$this-&gt;backupPath}\/redis_aof_{$timestamp}.aof\";\n\n            return copy($source, $destination);\n        } catch (Exception $e) {\n            error_log('AOF backup error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u5fa9\u5143\n    public function restoreBackup(string $backupFile): bool\n    {\n        try {\n            \/\/ Redis\u306e\u505c\u6b62\n            $this-&gt;redis-&gt;shutdown();\n\n            \/\/ \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u306e\u5fa9\u5143\n            $redisDir = $this-&gt;redis-&gt;config('GET', 'dir')['dir'];\n            return copy($backupFile, $redisDir . '\/dump.rdb');\n        } catch (Exception $e) {\n            error_log('Backup restoration error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-41\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u306e\u5b9f\u88c5\u65b9\u6cd5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-42\">1. \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u306e\u7ba1\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class RedisSecurity\n{\n    private $redis;\n\n    public function __construct(Redis $redis)\n    {\n        $this-&gt;redis = $redis;\n    }\n\n    \/\/ \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u306e\u9069\u7528\n    public function applySecuritySettings(array $settings = []): bool\n    {\n        try {\n            \/\/ \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\n            $defaultSettings = [\n                'requirepass' =&gt; $this-&gt;generateStrongPassword(),\n                'protected-mode' =&gt; 'yes',\n                'bind' =&gt; '127.0.0.1',\n                'maxclients' =&gt; '10000',\n                'rename-command' =&gt; ['FLUSHDB' =&gt; '', 'FLUSHALL' =&gt; ''],\n            ];\n\n            $finalSettings = array_merge($defaultSettings, $settings);\n\n            foreach ($finalSettings as $key =&gt; $value) {\n                $this-&gt;redis-&gt;config('SET', $key, $value);\n            }\n\n            return true;\n        } catch (Exception $e) {\n            error_log('Security settings error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ \u5f37\u529b\u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u751f\u6210\n    private function generateStrongPassword(int $length = 32): string\n    {\n        return bin2hex(random_bytes($length));\n    }\n\n    \/\/ \u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u306e\u5b9f\u88c5\n    public function implementAccessControl(array $allowedIPs): bool\n    {\n        try {\n            \/\/ protected-mode\u306e\u6709\u52b9\u5316\n            $this-&gt;redis-&gt;config('SET', 'protected-mode', 'yes');\n\n            \/\/ \u8a31\u53efIP\u30a2\u30c9\u30ec\u30b9\u306e\u8a2d\u5b9a\n            $this-&gt;redis-&gt;config('SET', 'bind', implode(' ', $allowedIPs));\n\n            return true;\n        } catch (Exception $e) {\n            error_log('Access control error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n\n    \/\/ SSL\/TLS\u8a2d\u5b9a\u306e\u6709\u52b9\u5316\n    public function enableTLS(string $certFile, string $keyFile): bool\n    {\n        try {\n            $this-&gt;redis-&gt;config('SET', 'tls-cert-file', $certFile);\n            $this-&gt;redis-&gt;config('SET', 'tls-key-file', $keyFile);\n            $this-&gt;redis-&gt;config('SET', 'tls-port', '6380');\n\n            return true;\n        } catch (Exception $e) {\n            error_log('TLS configuration error: ' . $e-&gt;getMessage());\n            return false;\n        }\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-43\">\u904b\u7528\u7ba1\u7406\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5b9a\u671f\u7684\u306a\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u76e3\u8996\u3068\u6700\u9069\u5316<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e1\u30c8\u30ea\u30af\u30b9\u306e\u53ce\u96c6<\/li>\n\n\n\n<li>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u5b9a\u671f\u5b9f\u884c<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306e\u9069\u7528<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u969c\u5bb3\u5bfe\u5fdc\u30d7\u30e9\u30f3<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u81ea\u52d5\u30d5\u30a7\u30a4\u30eb\u30aa\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304b\u3089\u306e\u5fa9\u65e7\u624b\u9806<\/li>\n\n\n\n<li>\u969c\u5bb3\u901a\u77e5\u30b7\u30b9\u30c6\u30e0\u306e\u69cb\u7bc9<\/li>\n\n\n\n<li>\u30a4\u30f3\u30b7\u30c7\u30f3\u30c8\u5bfe\u5fdc\u624b\u9806\u306e\u6587\u66f8\u5316<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>maxmemory\u30dd\u30ea\u30b7\u30fc\u306e\u6700\u9069\u5316<\/li>\n\n\n\n<li>persistence\u8a2d\u5b9a\u306e\u8abf\u6574<\/li>\n\n\n\n<li>\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a\u306e\u6700\u9069\u5316<\/li>\n\n\n\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u63a5\u7d9a\u6570\u306e\u7ba1\u7406<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7ba1\u7406<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u306e\u5b9a\u671f\u7684\u306a\u898b\u76f4\u3057<\/li>\n\n\n\n<li>\u30d1\u30b9\u30ef\u30fc\u30c9\u30dd\u30ea\u30b7\u30fc\u306e\u7ba1\u7406<\/li>\n\n\n\n<li>\u6697\u53f7\u5316\u8a2d\u5b9a\u306e\u78ba\u8a8d<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u76e3\u67fb\u306e\u5b9f\u65bd<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-44\">\u5b9f\u88c5\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u8a2d\u5b9a<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[ ] \u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u76e3\u8996<\/li>\n\n\n\n<li>[ ] \u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u72b6\u614b\u306e\u78ba\u8a8d<\/li>\n\n\n\n<li>[ ] \u30ec\u30a4\u30c6\u30f3\u30b7\u30fc\u306e\u76e3\u8996<\/li>\n\n\n\n<li>[ ] \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u63a5\u7d9a\u6570\u306e\u76e3\u8996<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u8a2d\u5b9a<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[ ] \u5b9a\u671f\u7684\u306aRDB\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/li>\n\n\n\n<li>[ ] AOF\u306e\u6709\u52b9\u5316<\/li>\n\n\n\n<li>[ ] \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u81ea\u52d5\u5316<\/li>\n\n\n\n<li>[ ] \u5fa9\u5143\u624b\u9806\u306e\u30c6\u30b9\u30c8<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[ ] \u5f37\u529b\u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u8a2d\u5b9a<\/li>\n\n\n\n<li>[ ] \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u8a2d\u5b9a<\/li>\n\n\n\n<li>[ ] SSL\/TLS\u306e\u6709\u52b9\u5316<\/li>\n\n\n\n<li>[ ] \u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u306e\u5b9f\u88c5<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u5b9f\u88c5\u3068\u8a2d\u5b9a\u3092\u9069\u5207\u306b\u884c\u3046\u3053\u3068\u3067\u3001\u672c\u756a\u74b0\u5883\u3067\u306eRedis\u306e\u5b89\u5b9a\u904b\u7528\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":{"0":"post-2440","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-php","7":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2440"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2440\/revisions"}],"predecessor-version":[{"id":2441,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2440\/revisions\/2441"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}