{"id":186019,"date":"2020-10-27T17:33:18","date_gmt":"2020-10-27T09:33:18","guid":{"rendered":"http:\/\/4563.org\/?p=186019"},"modified":"2020-10-27T17:33:18","modified_gmt":"2020-10-27T09:33:18","slug":"%e5%88%a0%e9%99%a4-%e4%bf%ae%e6%94%b9%e7%b3%bb%e7%bb%9f%e7%94%a8%e6%88%b7-redis-%e4%b8%ad%e7%9a%84-session-%e6%9c%89%e4%bb%80%e4%b9%88%e5%a5%bd%e7%9a%84%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=186019","title":{"rendered":"\u5220\u9664\/\u4fee\u6539\u7cfb\u7edf\u7528\u6237 redis \u4e2d\u7684 session \u6709\u4ec0\u4e48\u597d\u7684\u65b9\u6848"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5220\u9664\/\u4fee\u6539\u7cfb\u7edf\u7528\u6237 redis \u4e2d\u7684 session \u6709\u4ec0\u4e48\u597d\u7684\u65b9\u6848               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : noobma <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6bd4\u5982\u6211\u5728\u540e\u53f0\u628a\u4e00\u4e2a\u7528\u6237\u5220\u9664\u4e86\u6216\u8005\u628a\u67d0\u4e2a\u64cd\u4f5c\u7684\u6743\u9650\u5220\u6389\u4e86\uff0c\u4f46\u662f\u88ab\u64cd\u4f5c\u7684\u7528\u6237 session \u8fd8\u6ca1\u8fc7\u671f\uff0c\u6743\u9650\u6821\u9a8c\u662f\u76f4\u63a5\u4ece session \u91cc\u9762\u53d6\u7684\uff0c\u4e0d\u662f\u6bcf\u6b21\u90fd\u67e5\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u88ab\u64cd\u4f5c\u7684\u7528\u6237\u8fd8\u662f\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u6839\u636e userId \u4e4b\u7c7b\u7684\u4fe1\u606f\u67e5\u5230 redis \u4e2d\u7684 session \u505a\u66f4\u65b0\uff0c\u76f8\u5f53\u4e8e\u662f\u6839\u636e value \u67e5 key \u7684\u64cd\u4f5c\u4e86\u3002<\/p>\n<p>\u6211\u60f3\u5728 redis \u4e2d\u518d\u7ef4\u62a4\u4e00\u4e2a userId \u5bf9\u5e94 session keys \u7684\u5217\u8868\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u67e5\u5230\u7528\u6237\u5bf9\u5e94\u7684 session \u4e86\u3002\u4f46\u662f\u5982\u679c\u67d0\u4e2a session \u8fc7\u671f\u4e86\uff0c\u6211\u76d1\u542c\u5230\u8fc7\u671f\u7684 key\uff0c\u76f8\u5f53\u4e8e\u8fd8\u662f\u8981\u6839\u636e value \u67e5 key\uff0c\u67e5\u5230\u662f\u54ea\u4e2a userId \u5217\u8868\u91cc\u9762\u7684 key\uff0c\u518d\u628a\u5217\u4e2d\u7684 key \u5220\u9664\u3002<\/p>\n<p>\u60f3\u95ee\u4e0b\u5927\u4f6c\u95e8\u90fd\u662f\u5982\u4f55\u5904\u7406\u7684\u554a      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4015155\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Molita <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u5e72\u8106\u5728\u5220\u7528\u6237 \u66f4\u65b0\u6743\u9650\u7684\u65f6\u5019\u5220\u4e86\u561b-\u3002-                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015156\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : noobma <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Molita \u95ee\u9898\u5c31\u662f\u5728\u8fd9\u91cc\uff0c\u5982\u4f55\u627e\u5230\u88ab\u5220\u9664\u7528\u6237\u5728 redis \u4e2d\u7684 session key\uff0c\u751f\u4ea7\u73af\u5883`keys *`\u8fd9\u6837\u53bb\u904d\u5386\u4e0d\u5927\u59a5\u5427\u3002\u96be\u9053\u8981\u8fd9\u6837\u7528 SESSION:&lt;userId&gt;\u505a key                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015157\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Molita <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @noobma \u5728\u4f60\u4eec\u4e1a\u52a1\u91cf \u7528 userid \u505a key \u662f\u4e0d\u88ab\u5141\u8bb8\u7684\u561b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015158\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Molita <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Molita \u66f4\u6b63 \u91cf=\u91cc                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015159\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yeqizhang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u4ec0\u4e48 session \u8fc7\u671f\u4e86\uff0c\u8981\u628a key \u5220\u9664\u5462\uff1f\u8fd9\u4e2a key \u53ea\u505a\u66f4\u65b0\u5c31\u53ef\u4ee5\u4e86\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015160\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : noobma <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Molita \u597d\u50cf\u4e5f\u6ca1\u95ee\u9898\u5427\u3002\u5c31\u662f\u767b\u5f55\u540e\u7684\u8981\u91cd\u65b0\u751f\u6210\u4e00\u4e2a session key                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015161\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : noobma <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yeqizhang \u662f\u8981\u5220\u9664 userId \u5bf9\u5e94\u7684 session keys \u5217\u8868\u4e2d\u7684 key\uff0c\u8981\u662f\u4e0d\u5220\u7684\u8bdd\uff0c\u4f1a\u4e00\u76f4\u5360\u7740\u7a7a\u95f4\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015162\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : also24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u7528\u6237\u53ea\u5141\u8bb8\u62e5\u6709\u5355\u4e2a session \u5b58\u5728\uff1a<\/p>\n<p>\u90a3\u5728 redis \u6216\u8005\u6570\u636e\u5e93\u4e2d\u5b58\u4e00\u4e0b userId \u5bf9\u5e94 session key \u5c31\u597d\u3002<br \/>\u4e0d\u9700\u8981\u53bb\u7ef4\u62a4\u8fc7\u671f\uff0c\u6bcf\u6b21\u751f\u6210\u65b0\u7684 session \u7684\u65f6\u5019\u76f4\u63a5\u8986\u76d6\u5c31\u597d\u3002<\/p>\n<p>\u5982\u679c\u7528\u6237\u5141\u8bb8\u591a\u4e2a session \u5b58\u5728\uff1a<br \/>\u90a3\u6bcf\u6b21\u751f\u6210\u65b0\u7684 session \u7684\u65f6\u5019\uff0c\u987a\u4fbf\u5220\u4e00\u4e0b\u5df2\u8fc7\u671f\u6216\u8005\u5df2\u5931\u6548\u7684\u6570\u636e\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4015163\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : takemeaway <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9996\u5148\u4f60\u7684\u64cd\u4f5c\u662f\u5bf9\u7684\u3002<br \/>\u53e6\u5916\u4f60\u5982\u679c\u505a\u5355\u70b9\u767b\u5f55\u5c31\u4e0d\u9700\u8981\u8fd9\u6837\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5220\u9664\/\u4fee\u6539\u7cfb\u7edf\u7528\u6237 redis \u4e2d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/186019"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186019"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/186019\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186019"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}