{"id":17059,"date":"2025-04-18T23:31:48","date_gmt":"2025-04-18T15:31:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17059.html"},"modified":"2025-04-18T23:31:48","modified_gmt":"2025-04-18T15:31:48","slug":"redis%e8%ae%be%e8%ae%a1%e4%b8%8e%e5%ae%9e%e7%8e%b0-%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%ad%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17059.html","title":{"rendered":"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93"},"content":{"rendered":"<\/p>\n<h4>\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93<\/h4>\n<ul>\n<li>1\u3001 redis\u6570\u636e\u5e93<\/li>\n<li>2\u3001 \u6570\u636e\u5e93\u952e\u7a7a\u95f4<\/li>\n<li>3\u3001 \u8fc7\u671f\u65f6\u95f4\u548c\u5220\u9664\u7b56\u7565<\/li>\n<li>4\u3001 AOF\u3001RDB\u548c\u590d\u5236\u529f\u80fd\u5bf9\u8fc7\u671f\u952e\u7684\u5904\u7406<\/li>\n<li>5\u3001 \u901a\u77e5<\/li>\n<\/ul>\n<p>\u5982\u6709\u4fb5\u6743&#xff0c;\u8bf7\u8054\u7cfb&#xff5e; \u5982\u6709\u9519\u8bef&#xff0c;\u4e5f\u6b22\u8fce\u6279\u8bc4\u6307\u6b63&#xff5e; \u672c\u7bc7\u6587\u7ae0\u5927\u90e8\u5206\u662f\u6765\u81ea\u5b66\u4e60\u300aRedis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b\u7684\u7b14\u8bb0<\/p>\n<h2>1\u3001 redis\u6570\u636e\u5e93<\/h2>\n<p>Redis\u9ed8\u8ba4\u670916\u4e2a\u6570\u636e\u5e93&#xff0c;\u53ef\u4ee5\u6839\u636e\u914d\u7f6e\u8bbe\u7f6e\u6570\u636e\u5e93\u7684\u6570\u91cf\u3002\u6570\u636e\u5e93\u5b58\u50a8\u5728\u6570\u636e\u5e93\u6570\u7ec4\u4e2d&#xff0c;\u5982\u4e0bredisServer\u5b9a\u4e49\u4e2d\u7684*db\u5b57\u6bb5\u3002<\/p>\n<p>redisServer \u662f Redis \u670d\u52a1\u5668\u7684\u6838\u5fc3\u6570\u636e\u7ed3\u6784&#xff0c;\u5b83\u5305\u542b\u4e86 Redis \u8fd0\u884c\u65f6\u7684\u6240\u6709\u72b6\u6001\u548c\u914d\u7f6e\u4fe1\u606f\u3002redisServer \u662f\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf&#xff08;\u901a\u5e38\u547d\u540d\u4e3a server&#xff09;&#xff0c;\u5728 Redis \u6e90\u7801\u4e2d\u5b9a\u4e49\u4e3a struct redisServer \u7c7b\u578b\u3002\u5b83\u662f Redis \u5185\u90e8\u7ba1\u7406\u6570\u636e\u5e93\u3001\u5ba2\u6237\u7aef\u8fde\u63a5\u3001\u547d\u4ee4\u6267\u884c\u7b49\u6838\u5fc3\u529f\u80fd\u7684\u57fa\u7840\u3002<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">redisServer<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u914d\u7f6e\u76f8\u5173<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>configfile<span class=\"token punctuation\">;<\/span>          <span class=\"token comment\">\/\/ \u914d\u7f6e\u6587\u4ef6\u8def\u5f84<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> port<span class=\"token punctuation\">;<\/span>                  <span class=\"token comment\">\/\/ \u76d1\u542c\u7aef\u53e3<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>bindaddr<span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/\/ \u7ed1\u5b9a\u5730\u5740<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> databases<span class=\"token punctuation\">;<\/span>             <span class=\"token comment\">\/\/ \u6570\u636e\u5e93\u6570\u91cf<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6570\u636e\u5e93\u76f8\u5173<\/span><br \/>\n    redisDb <span class=\"token operator\">*<\/span>db<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u6570\u636e\u5e93\u6570\u7ec4<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> dbnum<span class=\"token punctuation\">;<\/span>                 <span class=\"token comment\">\/\/ \u5f53\u524d\u6570\u636e\u5e93\u7d22\u5f15<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u8fde\u63a5\u76f8\u5173<\/span><br \/>\n    list <span class=\"token operator\">*<\/span>clients<span class=\"token punctuation\">;<\/span>             <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u5217\u8868<\/span><br \/>\n    list <span class=\"token operator\">*<\/span>clients_pending_write<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7b49\u5f85\u5199\u5165\u7684\u5ba2\u6237\u7aef<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u547d\u4ee4\u76f8\u5173<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>commands<span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/\/ \u547d\u4ee4\u5b57\u5178<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6301\u4e45\u5316\u76f8\u5173<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>rdb_filename<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/\/ RDB \u6587\u4ef6\u8def\u5f84<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> aof_state<span class=\"token punctuation\">;<\/span>             <span class=\"token comment\">\/\/ AOF \u72b6\u6001<\/span><br \/>\n    sds aof_buf<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ AOF \u7f13\u51b2\u533a<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4e8b\u4ef6\u5faa\u73af<\/span><br \/>\n    aeEventLoop <span class=\"token operator\">*<\/span>el<span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/\/ \u4e8b\u4ef6\u5faa\u73af<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> hz<span class=\"token punctuation\">;<\/span>                    <span class=\"token comment\">\/\/ \u5b9a\u65f6\u4efb\u52a1\u9891\u7387<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u590d\u5236\u4e0e\u96c6\u7fa4<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>masterhost<span class=\"token punctuation\">;<\/span>          <span class=\"token comment\">\/\/ \u4e3b\u670d\u52a1\u5668\u5730\u5740<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> repl_state<span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/\/ \u590d\u5236\u72b6\u6001<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> cluster_enabled<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/\/ \u662f\u5426\u542f\u7528\u96c6\u7fa4<\/span><br \/>\n    ClusterState clusterState<span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ \u96c6\u7fa4\u4fe1\u606f<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8ba2\u9605\u53d1\u5e03<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>pubsub_channels<span class=\"token punctuation\">;<\/span>    <span class=\"token comment\">\/\/ \u9891\u9053\u8ba2\u9605\u5173\u7cfb<\/span><br \/>\n    list <span class=\"token operator\">*<\/span>pubsub_patterns<span class=\"token punctuation\">;<\/span>    <span class=\"token comment\">\/\/ \u6a21\u5f0f\u8ba2\u9605\u5173\u7cfb<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u7edf\u8ba1\u4e0e\u76d1\u63a7<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> stat_numcommands<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u547d\u4ee4\u603b\u6570<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> stat_numconnections<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8fde\u63a5\u603b\u6570<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7select\u547d\u4ee4\u8fdb\u884c\u5207\u6362\u6570\u636e\u5e93\u3002\u4f8b\u5982select 2\u8868\u793a\u5207\u6362\u52302\u53f7\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>Redis\u670d\u52a1\u7aef\u5229\u7528client\u7528\u6765\u7ba1\u7406\u6bcf\u4e2a\u8fde\u63a5\u5230\u670d\u52a1\u5668\u7684\u5ba2\u6237\u7aef\u7684\u72b6\u6001\u548c\u884c\u4e3a\u7684\u6838\u5fc3\u6570\u636e\u7ed3\u6784\u3002\u5f53\u4e00\u4e2a\u5ba2\u6237\u7aef&#xff08;\u5982 Redis CLI\u3001\u5e94\u7528\u7a0b\u5e8f\u6216\u5176\u4ed6 Redis \u5ba2\u6237\u7aef&#xff09;\u901a\u8fc7\u7f51\u7edc\u8fde\u63a5\u5230 Redis \u670d\u52a1\u7aef\u65f6&#xff0c;Redis \u670d\u52a1\u7aef\u4f1a\u4e3a\u8be5\u8fde\u63a5\u521b\u5efa\u4e00\u4e2a redisClient \u5b9e\u4f8b\u3002\u8fd9\u4e2a\u5b9e\u4f8b\u7528\u4e8e\u8ddf\u8e2a\u5ba2\u6237\u7aef\u7684\u72b6\u6001&#xff08;\u5982\u8fde\u63a5\u4fe1\u606f\u3001\u6267\u884c\u7684\u547d\u4ee4\u3001\u6570\u636e\u5e93\u9009\u62e9\u7b49&#xff09;&#xff0c;\u5e76\u8d1f\u8d23\u5904\u7406\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u8bf7\u6c42\u4ee5\u53ca\u5411\u5ba2\u6237\u7aef\u8fd4\u56de\u54cd\u5e94\u3002<\/p>\n<p><span class=\"token keyword\">typedef<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">client<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u57fa\u672c\u4fe1\u606f<\/span><br \/>\n    <span class=\"token class-name\">uint64_t<\/span> id<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef ID<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> fd<span class=\"token punctuation\">;<\/span>                    <span class=\"token comment\">\/\/ \u6587\u4ef6\u63cf\u8ff0\u7b26<\/span><br \/>\n    sds name<span class=\"token punctuation\">;<\/span>                  <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u540d\u79f0<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> flags<span class=\"token punctuation\">;<\/span>                 <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u72b6\u6001\u6807\u5fd7<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u5165\u7f13\u51b2\u533a<\/span><br \/>\n    sds querybuf<span class=\"token punctuation\">;<\/span>              <span class=\"token comment\">\/\/ \u8f93\u5165\u7f13\u51b2\u533a<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> argc<span class=\"token punctuation\">;<\/span>                  <span class=\"token comment\">\/\/ \u53c2\u6570\u4e2a\u6570<\/span><br \/>\n    robj <span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>argv<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u53c2\u6570\u6570\u7ec4<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">redisCommand<\/span> <span class=\"token operator\">*<\/span>cmd<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5f53\u524d\u547d\u4ee4<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u51fa\u7f13\u51b2\u533a<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> buf<span class=\"token punctuation\">[<\/span>PROTO_REPLY_CHUNK_BYTES<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u56fa\u5b9a\u5927\u5c0f\u7684\u8f93\u51fa\u7f13\u51b2\u533a<\/span><br \/>\n    list <span class=\"token operator\">*<\/span>reply<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u52a8\u6001\u5206\u914d\u7684\u8f93\u51fa\u7f13\u51b2\u533a<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6570\u636e\u5e93\u76f8\u5173<\/span><br \/>\n    redisDb <span class=\"token operator\">*<\/span>db<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u5f53\u524d\u6570\u636e\u5e93<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> dictid<span class=\"token punctuation\">;<\/span>                <span class=\"token comment\">\/\/ \u6570\u636e\u5e93\u7d22\u5f15<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u590d\u5236\u76f8\u5173<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> replstate<span class=\"token punctuation\">;<\/span>             <span class=\"token comment\">\/\/ \u590d\u5236\u72b6\u6001<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> reploff<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/\/ \u590d\u5236\u504f\u79fb\u91cf<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u963b\u585e\u4e0e\u8d85\u65f6<\/span><br \/>\n    <span class=\"token class-name\">mstime_t<\/span> bpop_timeout<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/\/ \u963b\u585e\u8d85\u65f6\u65f6\u95f4<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> lastinteraction<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4e0a\u6b21\u4ea4\u4e92\u65f6\u95f4<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u7edf\u8ba1\u4fe1\u606f<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> query_start_time<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u547d\u4ee4\u5f00\u59cb\u6267\u884c\u65f6\u95f4<\/span><br \/>\n    <span class=\"token class-name\">size_t<\/span> obuf_mem<span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/\/ \u8f93\u51fa\u7f13\u51b2\u533a\u5185\u5b58\u5360\u7528<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u5176\u4ed6<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> authenticated<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/\/ \u662f\u5426\u5df2\u8ba4\u8bc1<\/span><br \/>\n    connection <span class=\"token operator\">*<\/span>conn<span class=\"token punctuation\">;<\/span>          <span class=\"token comment\">\/\/ \u8fde\u63a5\u5bf9\u8c61<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>pubsub_channels<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/\/ \u8ba2\u9605\u7684\u9891\u9053<\/span><br \/>\n    list <span class=\"token operator\">*<\/span>pubsub_patterns<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/\/ \u8ba2\u9605\u7684\u6a21\u5f0f<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> client<span class=\"token punctuation\">;<\/span><\/p>\n<p>client\u4e2d\u7684db\u5b57\u6bb5\u5c31\u8868\u793a\u5f53\u524d\u4f7f\u7528\u7684\u6570\u636e\u5e93\u3002select\u547d\u4ee4\u5176\u5b9e\u5e95\u5c42\u5b9e\u73b0\u5c31\u662f\u4fee\u6539client\u7684db\u8fd9\u4e2a\u5b57\u6bb5&#xff0c;\u8fd9\u4e2a\u5b57\u6bb5\u5c31\u4f1a\u6307\u5411redisServer db\u6570\u7ec4\u7684\u5177\u4f53\u67d0\u4e2a\u6570\u636e\u5e93\u3002<\/p>\n<h2>2\u3001 \u6570\u636e\u5e93\u952e\u7a7a\u95f4<\/h2>\n<p>redis\u9ed8\u8ba4\u670916\u4e2a\u6570\u636e\u5e93&#xff0c;\u6bcf\u4e2a\u6570\u636e\u5e93\u90fd\u662f\u952e\u503c\u5bf9\u6570\u636e\u5e93&#xff0c;\u6bcf\u4e2a\u6570\u636e\u5e93\u90fd\u662f\u6709redisServer\u4e2d\u63d0\u5230\u7684redisDB\u6570\u636e\u7ed3\u6784\u5b58\u50a8\u3002<\/p>\n<p><span class=\"token keyword\">typedef<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">redisDb<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u952e\u7a7a\u95f4&#xff0c;\u4fdd\u5b58\u6240\u6709\u7684\u952e\u503c\u5bf9<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>dict<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/\/ \u4e3b\u5b57\u5178&#xff0c;\u5b58\u50a8\u952e\u503c\u5bf9<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>expires<span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/\/ \u8fc7\u671f\u5b57\u5178&#xff0c;\u5b58\u50a8\u952e\u7684\u8fc7\u671f\u65f6\u95f4\u3002\u8fc7\u671fkey\u7684\u5220\u9664\u7b56\u7565&#xff1a;\u5b9a\u671f\u5220\u9664\u548c\u60f0\u6027\u5220\u9664<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u963b\u585e\u64cd\u4f5c<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>blocking_keys<span class=\"token punctuation\">;<\/span>      <span class=\"token comment\">\/\/ \u963b\u585e\u952e\u7684\u96c6\u5408<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>ready_keys<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/\/ \u5df2\u7ecf\u51c6\u5907\u597d\u7684\u963b\u585e\u952e<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6301\u4e45\u5316\u76f8\u5173<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> id<span class=\"token punctuation\">;<\/span>                   <span class=\"token comment\">\/\/ \u6570\u636e\u5e93 ID<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> avg_ttl<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/\/ \u5e73\u5747 TTL<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4e8b\u52a1\u76f8\u5173<\/span><br \/>\n    dict <span class=\"token operator\">*<\/span>watched_keys<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/\/ \u88ab\u76d1\u89c6\u7684\u952e<\/span><\/p>\n<p><span class=\"token punctuation\">}<\/span> redisDb<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u91cc\u7684\u952e\u7a7a\u95f4\u5c31\u662f\u548c\u6211\u4eec\u6240\u89c1\u7684\u6570\u636e\u5e93\u76f4\u63a5\u5bf9\u5e94\u3002\u5b58\u50a8\u7684\u952e\u5c31\u662fdict\u4e2d\u7684\u952e&#xff0c;\u5b58\u50a8\u7684\u503c\u3010\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u54c8\u5e0c\u2026\u3011\u5c31\u662fdict\u4e2d\u7684\u503c\u3002<\/p>\n<h2>3\u3001 \u8fc7\u671f\u65f6\u95f4\u548c\u5220\u9664\u7b56\u7565<\/h2>\n<p>\u548c\u952e\u8fc7\u671f\u76f8\u5173\u7684\u547d\u4ee4&#xff1a;<\/p>\n<table>\n<tr>\u547d\u4ee4\u63cf\u8ff0\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>EXPIRE<\/td>\n<td>\u8bbe\u7f6e\u952e\u7684\u8fc7\u671f\u65f6\u95f4&#xff08;\u79d2&#xff09;<\/td>\n<td>EXPIRE key seconds<\/td>\n<\/tr>\n<tr>\n<td>PEXPIRE<\/td>\n<td>\u8bbe\u7f6e\u952e\u7684\u8fc7\u671f\u65f6\u95f4&#xff08;\u6beb\u79d2&#xff09;<\/td>\n<td>PEXPIRE key milliseconds<\/td>\n<\/tr>\n<tr>\n<td>EXPIREAT<\/td>\n<td>\u8bbe\u7f6e\u952e\u5728\u6307\u5b9a\u65f6\u95f4\u6233&#xff08;\u79d2&#xff09;\u540e\u8fc7\u671f<\/td>\n<td>EXPIREAT key timestamp<\/td>\n<\/tr>\n<tr>\n<td>PEXPIREAT<\/td>\n<td>\u8bbe\u7f6e\u952e\u5728\u6307\u5b9a\u65f6\u95f4\u6233&#xff08;\u6beb\u79d2&#xff09;\u540e\u8fc7\u671f<\/td>\n<td>PEXPIREAT key milliseconds-timestamp<\/td>\n<\/tr>\n<tr>\n<td>TTL<\/td>\n<td>\u67e5\u770b\u952e\u5269\u4f59\u7684\u8fc7\u671f\u65f6\u95f4&#xff08;\u79d2&#xff09;<\/td>\n<td>TTL key<\/td>\n<\/tr>\n<tr>\n<td>PTTL<\/td>\n<td>\u67e5\u770b\u952e\u5269\u4f59\u7684\u8fc7\u671f\u65f6\u95f4&#xff08;\u6beb\u79d2&#xff09;<\/td>\n<td>PTTL key<\/td>\n<\/tr>\n<tr>\n<td>PERSIST<\/td>\n<td>\u79fb\u9664\u952e\u7684\u8fc7\u671f\u65f6\u95f4&#xff0c;\u4f7f\u5176\u6c38\u4e0d\u8fc7\u671f<\/td>\n<td>PERSIST key<\/td>\n<\/tr>\n<tr>\n<td>SET \u2026 EX<\/td>\n<td>\u8bbe\u7f6e\u952e\u503c\u5bf9\u5e76\u6307\u5b9a\u8fc7\u671f\u65f6\u95f4&#xff08;\u79d2&#xff09;<\/td>\n<td>SET key value EX seconds<\/td>\n<\/tr>\n<tr>\n<td>SET \u2026 PX<\/td>\n<td>\u8bbe\u7f6e\u952e\u503c\u5bf9\u5e76\u6307\u5b9a\u8fc7\u671f\u65f6\u95f4&#xff08;\u6beb\u79d2&#xff09;<\/td>\n<td>SET key value PX milliseconds<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u65e0\u8bba\u662fEXPIRE\u3001PEXPIRE\u8fd8\u662fEXPIREAT\u5e95\u5c42\u90fd\u662f\u4f7f\u7528PEXPIREAT\u547d\u4ee4\u8fdb\u884c\u5b9e\u73b0\u7684\u3002<\/p>\n<p>\u5e95\u5c42\u5b9e\u73b0&#xff1a; \u901a\u8fc7\u4e0a\u9762redisDB\u6570\u636e\u7ed3\u6784\u5c31\u53ef\u4ee5\u770b\u5230\u6709\u4e2a\u5b57\u5178\u5c5e\u6027expires\u8fc7\u671f\u5b57\u5178&#xff0c;\u6240\u6709\u7684\u952e\u503c\u5bf9\u90fd\u5b58\u50a8\u5230\u952e\u7a7a\u95f4dict\u4e0a&#xff0c;\u800c\u6240\u6709\u952e\u7684\u8fc7\u671f\u65f6\u95f4\u90fd\u5b58\u50a8\u5230\u8fc7\u671f\u5b57\u5178expires\u4e2d\u3002expires\u4e2d\u7684key\u5c31\u662f\u6307\u5411\u952e\u7a7a\u95f4\u4e2d\u7684\u952e\u5bf9\u8c61key&#xff0c;\u800cvalue\u5c31\u662f\u4e00\u4e2along long\u7c7b\u578b\u7684\u6574\u6570\u3002<\/p>\n<p>\u5982\u4f55\u5224\u65ad\u4e00\u4e2a\u952e\u662f\u4e0d\u662f\u8fc7\u671f\u4e86\u5462&#xff1f; \u901a\u8fc7\u8fc7\u671f\u5b57\u5178\u4e2d\u67d0\u4e2a\u952e\u7684\u8fc7\u671f\u65f6\u95f4\u3010\u952e\u7684value\u503c\u3011&#xff0c;\u5982\u679c\u5f53\u524d\u65f6\u95f4\u5927\u4e8e\u8fc7\u671f\u65f6\u95f4\u8bc1\u660e\u8fd9\u4e2a\u952e\u5df2\u7ecf\u8fc7\u671f\u3002<\/p>\n<p>\u952e\u8fc7\u671f\u4e86&#xff0c;\u600e\u4e48\u5220\u9664\u5462&#xff1f; \u5220\u9664\u7b56\u7565\u4e3b\u8981\u6709\u4e09\u79cd&#xff1a;<\/p>\n<ul>\n<li>\u5b9a\u65f6\u5220\u9664&#xff1a;\u6bcf\u5f53\u7ed9\u67d0\u4e2a\u952e\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u7684\u65f6\u5019&#xff0c;\u90fd\u4f1a\u4e3a\u5176\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u5668\u3002\u5f53\u5230\u8fc7\u671f\u65f6\u95f4\u4e4b\u540e&#xff0c;\u5c31\u4f1a\u7acb\u523b\u5220\u9664\u3002\u6240\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u5bf9\u4e8e\u5185\u5b58\u662f\u53cb\u597d\u7684&#xff0c;\u4e00\u65e6\u8fc7\u671f\u5c31\u4f1a\u5220\u9664\u4e0d\u4f1a\u5360\u7528\u591a\u4f59\u7684\u5185\u5b58&#xff1b;\u7f3a\u70b9&#xff1a;\u6d6a\u8d39CPU\u8d44\u6e90&#xff0c;\u5c24\u5176\u662f\u5b58\u5728\u5927\u91cf\u7684\u8fc7\u671f\u952e&#xff0c;\u5b9a\u65f6\u5668&#xff0c;CPU\u7684\u6d6a\u8d39\u66f4\u660e\u663e\u3002<\/li>\n<li>\u60f0\u6027\u5220\u9664&#xff1a;\u53ea\u6709\u7528\u5230\u8fd9\u4e2a\u952e\u7684\u65f6\u5019\u624d\u4f1a\u6821\u9a8c\u8fd9\u4e2a\u952e\u503c\u5bf9\u662f\u4e0d\u662f\u5df2\u7ecf\u8fc7\u671f\u4e86&#xff0c;\u5982\u679c\u8fc7\u671f\u5219\u8fdb\u884c\u5220\u9664\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u4f1a\u6d6a\u8d39\u5360\u7528\u591a\u4f59CPU\u8d44\u6e90&#xff0c;\u4f46\u662f\u4f1a\u5360\u7528\u5927\u91cf\u5185\u5b58\u3002\u4f8b\u5982\u67d0\u4e9b\u952e\u5df2\u7ecf\u8fc7\u671f&#xff0c;\u4f46\u662f\u957f\u671f\u53c8\u4e0d\u8bbf\u95ee\u5c31\u5bfc\u81f4\u4e00\u76f4\u5360\u7528\u5185\u5b58&#xff0c;\u53ef\u4ee5\u770b\u6210\u5185\u5b58\u6cc4\u6f0f\u3002Redis\u5e95\u5c42\u901a\u8fc7expireIfNeed\u65b9\u6cd5\u8fdb\u884c\u5b9e\u73b0\u3002<\/li>\n<li>\u5b9a\u671f\u5220\u9664&#xff1a;\u8fd9\u79cd\u7b56\u7565\u662f\u5b9a\u671f\u7684\u53bb\u6e05\u7406\u4e00\u5b9a\u6570\u91cf\u7684\u8fc7\u671f\u952e\u3002\u7efc\u5408\u8861\u91cfCPU\u548c\u5185\u5b58\u8d44\u6e90&#xff0c;\u4f46\u662f\u8fd9\u79cd\u65b9\u5f0f\u7684\u96be\u70b9\u662f\u6267\u884c\u7684\u9891\u7387\u548c\u65f6\u95f4\u3002Redis\u5e95\u5c42\u901a\u8fc7activeExpireCycle\u65b9\u6cd5\u8fdb\u884c\u5b9e\u73b0\u3002<\/li>\n<\/ul>\n<p>Redis\u4f7f\u7528\u60f0\u6027\u5220\u9664\u548c\u5b9a\u671f\u5220\u9664\u76f8\u7ed3\u5408\u7684\u65b9\u5f0f\u8fdb\u884c\u8fc7\u671f\u952e\u7684\u5220\u9664\u3002<\/p>\n<h2>4\u3001 AOF\u3001RDB\u548c\u590d\u5236\u529f\u80fd\u5bf9\u8fc7\u671f\u952e\u7684\u5904\u7406<\/h2>\n<table>\n<tr>\u7c7b\u578b\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>\u751f\u6210RDB\u6587\u4ef6<\/td>\n<td>\u65e0\u8bba\u662f\u6267\u884csave\u547d\u4ee4\u3001bgsave\u547d\u4ee4&#xff0c;\u8fd8\u662f\u914d\u7f6e\u9879\u4e2d\u7684save\u5468\u671f&#xff0c;\u5728\u8fdb\u884c\u751f\u6210RDB\u6587\u4ef6\u7684\u65f6\u5019&#xff0c;\u8fc7\u671f\u952e\u90fd\u4e0d\u4f1a\u4fdd\u5b58&#xff0c;\u4f1a\u5bf9\u6570\u636e\u5e93\u4e2d\u7684\u952e\u8fdb\u884c\u68c0\u67e5<\/td>\n<\/tr>\n<tr>\n<td>\u52a0\u8f7dRDB\u6587\u4ef6<\/td>\n<td>\u9488\u5bf9\u4e8e\u4e3b\u670d\u52a1\u5668&#xff1a;\u5728\u52a0\u8f7dRDB\u6587\u4ef6\u7684\u65f6\u5019&#xff0c;\u4f1a\u4e3b\u52a8\u8fc7\u6ee4\u6389\u8fc7\u671f\u7684\u952e\u503c\u5bf9&#xff1b;\u4ece\u670d\u52a1\u5668\u5219\u4f1a\u5c06\u6240\u6709\u7684\u952e\u90fd\u52a0\u8f7d\u5230\u6570\u636e\u5e93\u5185\u5b58\u4e2d&#xff0c;\u4e0d\u8fc7\u7b49\u4e3b\u4ece\u540c\u6b65\u7684\u65f6\u5019&#xff0c;\u4ece\u670d\u52a1\u5668\u5c31\u4f1a\u5220\u9664\u81ea\u8eab\u6240\u6709\u6570\u636e&#xff0c;\u52a0\u8f7d\u4e3b\u670d\u52a1\u5668\u7684RDB\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>AOF\u6587\u4ef6\u5199\u5165<\/td>\n<td>\u5982\u679c\u6570\u636e\u5e93\u4e2d\u7684\u952e\u8fc7\u671f&#xff0c;\u4e0d\u4f1a\u5bf9AOF\u6587\u4ef6\u6709\u4efb\u4f55\u5f71\u54cd\u3002\u9664\u975e\u89e6\u53d1\u5b9a\u671f\u5220\u9664\u6216\u8005\u60f0\u6027\u5220\u9664&#xff0c;\u5728\u5b9a\u671f\u5220\u9664\u6216\u8005\u60f0\u6027\u5220\u9664\u7684\u65f6\u5019&#xff0c;\u4f1a\u5f80AOF\u6587\u4ef6\u4e2d\u5199\u4e00\u6761del\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>AOF\u91cd\u5199<\/td>\n<td>AOF\u91cd\u5199\u548c\u751f\u6210RDB\u6587\u4ef6\u4e00\u6837&#xff0c;\u4e0d\u4f1a\u5bf9\u8fc7\u671f\u952e\u8fdb\u884c\u4fdd\u5b58<\/td>\n<\/tr>\n<tr>\n<td>\u590d\u5236<\/td>\n<td>\u4e3b\u670d\u52a1\u5668\u5220\u9664\u4e00\u4e2a\u8fc7\u671f\u952e\u4e4b\u540e&#xff0c;\u4f1a\u663e\u5f0f\u5730\u5411\u6240\u6709\u7684\u4ece\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2aDEL\u547d\u4ee4&#xff1b;\u4ece\u670d\u52a1\u5668\u5e76\u4e0d\u4f1a\u4e3b\u52a8\u7684\u5220\u9664\u8fc7\u671f\u952e&#xff0c;\u53ea\u6709\u6536\u5230\u4e3b\u670d\u52a1\u5668\u7684DEL\u547d\u4ee4\u624d\u4f1a\u5220\u9664&#xff0c;\u8fd9\u4e48\u505a\u4e3a\u4e86\u4e3b\u4ece\u4e00\u81f4\u6027\u3002\u5982\u679c\u4e00\u4e2a\u952e\u8fc7\u671f\u4e86&#xff0c;\u4ece\u670d\u52a1\u5668\u6ca1\u6709\u6536\u5230\u4e3b\u670d\u52a1\u5668\u7684DEL\u547d\u4ee4&#xff0c;\u90a3\u4e48\u4ece\u670d\u52a1\u5668\u4ecd\u7136\u5b58\u5728\u8fd9\u4e2a\u952e\u503c\u5bf9&#xff0c;\u8fd9\u4e2a\u65f6\u5019\u5f53\u4ece\u670d\u52a1\u6536\u5230\u5ba2\u6237\u7aef\u8bfbget\u547d\u4ee4&#xff0c;\u4ece\u670d\u52a1\u5668\u4f1a\u5c06\u8fd9\u4e2a\u952e\u5bf9\u5e94\u7684\u503c\u8fd4\u56de\u51fa\u53bb\u3002\u3010\u5982\u679cRedis\u96c6\u7fa4\u914d\u7f6e\u8bfb\u5199\u5206\u79bb&#xff0c;\u9700\u8981\u6ce8\u610f\u8fd9\u70b9\u3011<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>5\u3001 \u901a\u77e5<\/h2>\n<p>\u8fd9\u91cc\u7684\u901a\u77e5\u4e0e\u53d1\u5e03\u8ba2\u9605\u3010\u5ba2\u6237\u7aef\u53d1\u5e03\u5230\u9891\u9053\u4e00\u4e2a\u503c&#xff0c;\u670d\u52a1\u7aef\u5c31\u4f1a\u5411\u8ba2\u9605\u8fd9\u4e2a\u9891\u9053\u7684\u5ba2\u6237\u7aef\u53d1\u9001\u8fd9\u4e2a\u503c&#xff0c;\u5373\u8ba2\u9605\u8005\u5c31\u4f1a\u6536\u5230\u8fd9\u4e2a\u503c&#xff08;\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u957f\u8fde\u63a5&#xff09;\u3011\u4e0d\u540c\u3002 \u901a\u77e5\u5206\u4e3a\u952e\u7a7a\u95f4\u901a\u77e5\u3010\u67d0\u4e2a\u952e\u6267\u884c\u4e86\u54ea\u4e9b\u547d\u4ee4\u3011\u548c\u952e\u4e8b\u4ef6\u901a\u77e5\u3010\u67d0\u4e2a\u547d\u4ee4\u88ab\u54ea\u4e9b\u952e\u6267\u884c\u4e86\u3011\u3002\u7528\u4e8e\u63a7\u5236\u901a\u77e5\u7684\u53c2\u6570&#xff1a;notify-keyspace-events notify-keyspace-events\u7684\u6240\u6709\u5b57\u7b26\u53d6\u503c&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u7b26\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>K<\/td>\n<td>\u542f\u7528\u952e\u7a7a\u95f4\u901a\u77e5&#xff08;Keyspace notifications&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>E<\/td>\n<td>\u542f\u7528\u952e\u4e8b\u4ef6\u901a\u77e5&#xff08;Keyevent notifications&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>g<\/td>\n<td>\u901a\u7528\u547d\u4ee4&#xff08;\u5982 DEL\u3001EXPIRE\u3001RENAME \u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>s<\/td>\n<td>\u5b57\u7b26\u4e32\u547d\u4ee4&#xff08;\u5982 SET\u3001GET\u3001INCR \u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>\u5217\u8868\u547d\u4ee4&#xff08;\u5982 LPUSH\u3001LPOP \u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>h<\/td>\n<td>\u54c8\u5e0c\u547d\u4ee4&#xff08;\u5982 HSET\u3001HGET \u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>z<\/td>\n<td>\u6709\u5e8f\u96c6\u5408\u547d\u4ee4&#xff08;\u5982 ZADD\u3001ZREM \u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>\u8fc7\u671f\u4e8b\u4ef6&#xff08;\u5f53\u952e\u56e0\u8fc7\u671f\u800c\u88ab\u5220\u9664\u65f6\u89e6\u53d1&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>e<\/td>\n<td>\u9a71\u9010\u4e8b\u4ef6&#xff08;\u5f53\u952e\u56e0\u5185\u5b58\u4e0d\u8db3\u800c\u88ab\u9a71\u9010\u65f6\u89e6\u53d1&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>A<\/td>\n<td>\u542f\u7528\u6240\u6709\u4e8b\u4ef6&#xff08;\u76f8\u5f53\u4e8e g$lshzxe \u7684\u7ec4\u5408&#xff09;\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5e38\u89c1\u7ec4\u5408&#xff1a;<\/p>\n<table>\n<tr>\u7ec4\u5408\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>KEA<\/td>\n<td>\u542f\u7528\u6240\u6709\u952e\u7a7a\u95f4\u548c\u952e\u4e8b\u4ef6\u901a\u77e5\u3002<\/td>\n<\/tr>\n<tr>\n<td>Ex<\/td>\n<td>\u4ec5\u542f\u7528\u952e\u4e8b\u4ef6\u901a\u77e5\u4e2d\u7684\u8fc7\u671f\u4e8b\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>Kg<\/td>\n<td>\u4ec5\u542f\u7528\u952e\u7a7a\u95f4\u901a\u77e5\u4e2d\u7684\u901a\u7528\u547d\u4ee4\u4e8b\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>Ksx<\/td>\n<td>\u542f\u7528\u952e\u7a7a\u95f4\u901a\u77e5\u4e2d\u7684\u5b57\u7b26\u4e32\u547d\u4ee4\u548c\u8fc7\u671f\u4e8b\u4ef6\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u901a\u77e5\u529f\u80fd\u662f\u901a\u8fc7 notifyKeySpaceEvent\u51fd\u6570\u5b9e\u73b0\u7684&#xff0c;\u6bcf\u4e2a\u547d\u4ee4\u6267\u884c\u6210\u529f\u90fd\u4f1a\u6267\u884c\u8fd9\u4e2a\u65b9\u6cd5\u3002\u8fd9\u4e2a\u65b9\u6cd5\u7684\u5e95\u5c42\u5176\u5b9e\u662f\u4f7f\u7528\u7684\u53d1\u5e03\u8ba2\u9605\u529f\u80fd\u3002 \u952e\u7a7a\u95f4\u901a\u77e5&#xff1a; \u9891\u9053\u683c\u5f0f&#xff1a;_keyspace&#064;&lt;db&gt;_:&lt;key&gt; \u6d88\u606f\u5185\u5bb9&#xff1a;\u64cd\u4f5c\u7c7b\u578b&#xff08;\u5982 set\u3001del\u3001expire \u7b49&#xff09;\u3002 \u952e\u4e8b\u4ef6\u901a\u77e5&#xff1a; \u9891\u9053\u683c\u5f0f&#xff1a;_keyevent&#064;&lt;db&gt;_:&lt;event&gt; \u6d88\u606f\u5185\u5bb9&#xff1a;\u952e\u540d\u3002<\/p>\n<p>\u952e\u7a7a\u95f4\u548c\u952e\u4e8b\u4ef6\u901a\u77e5\u6d41\u7a0b\u56fe&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418153146-680270629957f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb930\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u5982\u6709\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\uff5e\u5982\u6709\u9519\u8bef\uff0c\u4e5f\u6b22\u8fce\u6279\u8bc4\u6307\u6b63\uff5e\u672c\u7bc7\u6587\u7ae0\u5927\u90e8\u5206\u662f\u6765\u81ea\u5b66\u4e60\u300aRedis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b\u7684\u7b14\u8bb0\u3002<\/p>\n","protected":false},"author":2,"featured_media":17058,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[105,56,100,43,305,398,44],"topic":[],"class_list":["post-17059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-redis","tag-56","tag-100","tag-43","tag-305","tag-398","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \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\/17059.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb930\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u5982\u6709\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\uff5e\u5982\u6709\u9519\u8bef\uff0c\u4e5f\u6b22\u8fce\u6279\u8bc4\u6307\u6b63\uff5e\u672c\u7bc7\u6587\u7ae0\u5927\u90e8\u5206\u662f\u6765\u81ea\u5b66\u4e60\u300aRedis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b\u7684\u7b14\u8bb0\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17059.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:31:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418153146-680270629957f.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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17059.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17059.html\",\"name\":\"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:31:48+00:00\",\"dateModified\":\"2025-04-18T15:31:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17059.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17059.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17059.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\"}]},{\"@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":"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \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\/17059.html","og_locale":"zh_CN","og_type":"article","og_title":"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb930\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u5982\u6709\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\uff5e\u5982\u6709\u9519\u8bef\uff0c\u4e5f\u6b22\u8fce\u6279\u8bc4\u6307\u6b63\uff5e\u672c\u7bc7\u6587\u7ae0\u5927\u90e8\u5206\u662f\u6765\u81ea\u5b66\u4e60\u300aRedis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b\u7684\u7b14\u8bb0\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/17059.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:31:48+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418153146-680270629957f.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/17059.html","url":"https:\/\/www.wsisp.com\/helps\/17059.html","name":"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:31:48+00:00","dateModified":"2025-04-18T15:31:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17059.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17059.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17059.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Redis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0-\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93"}]},{"@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\/17059","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=17059"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17059\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/17058"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17059"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}