{"id":201517,"date":"2025-05-10T10:24:55","date_gmt":"2025-05-10T02:24:55","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201517\/"},"modified":"2025-05-10T10:24:55","modified_gmt":"2025-05-10T02:24:55","slug":"%e8%af%a6%e8%a7%a3redis%e4%b8%adkey%e7%9a%84%e5%91%bd%e5%90%8d%e8%a7%84%e8%8c%83%e5%92%8c%e5%80%bc%e7%9a%84%e5%91%bd%e5%90%8d%e8%a7%84%e8%8c%83","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/201517\/","title":{"rendered":"\u8be6\u89e3Redis\u4e2dkey\u7684\u547d\u540d\u89c4\u8303\u548c\u503c\u7684\u547d\u540d\u89c4\u8303"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u8be6\u89e3Redis\u4e2dkey\u7684\u547d\u540d\u89c4\u8303\u548c\u503c\u7684\u547d\u540d\u89c4\u8303<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300a\u8be6\u89e3Redis\u4e2dkey\u7684\u547d\u540d\u89c4\u8303\u548c\u503c\u7684\u547d\u540d\u89c4\u8303\u300b\uff0c\u8986\u76d6\u4e86\u6570\u636e\u5e93\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<p>\u6570\u636e\u5e93\u4e2d\u5f97\u70ed\u70b9\u6570\u636ekey\u547d\u540d\u60ef\u4f8b<\/p>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u8868\u540d:\u4e3b\u952e\u540d:\u4e3b\u952e\u503c:\u5b57\u6bb5\u540d<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u4f8b\u5982<\/td>\n<td>user:id:0001:name<\/td>\n<\/tr>\n<tr>\n<td>\u4f8b\u5982<\/td>\n<td>user:id:0002:name<\/td>\n<\/tr>\n<tr>\n<td>\u4f8b\u5982<\/td>\n<td>order:id:s2002:price<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0a\u9762\u7684key\u5bf9\u5e94\u7684\u503c\u5219\u53ef\u4ee5\u662f<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5b58\u653e\u7684\u65b9\u5f0f<\/th>\n<th>key<\/th>\n<th>value<\/th>\n<th>\u4f18\u70b9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5355\u72ec\u7684key:value\u5f62\u5f0f<\/td>\n<td>order:id:s2002:price<\/td>\n<td>2000<\/td>\n<td>\u65b9\u4fbf\u7b80\u5355\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982incr\u81ea\u589e\u6216\u81ea\u51cf<\/td>\n<\/tr>\n<tr>\n<td>json\u683c\u5f0f<\/td>\n<td>user:id:0001<\/td>\n<td>{id:0001,name:&#8221;\u5f20\u4e09&#8221;}<\/td>\n<td>\u65b9\u4fbf\u4e00\u6b21\u6027\u5b58\u548c\u53d6\u6570\u636e\uff0c\u4f46\u662f\u4e0d\u65b9\u4fbf\u66f4\u65b0\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>redis \u7f13\u5b58 key\u5e38\u91cf\u547d\u540d\u89c4\u5219\u793a\u4f8b<br \/><\/h3>\n<pre>\npackage com.awj.mall.restfulapi.common.consts;\n\npublic class CacheConsts {\n\n  \/\/ \u77ed\u4fe1\u9a8c\u8bc1\u7801\u7c7b\u578b\n  \/**\n   * \u767b\u5f55\n   *\/\n  public static final String SMS_TYPE_LOGIN = \"cache:api:sms_login_\";\n  \/**\n   * \u91cd\u7f6e\u5bc6\u7801\n   *\/\n  public static final String SMS_TYPE_RESETPWD = \"cache:api:sms_resetpwd_\";\n  \/**\n   * \u91cd\u7f6e\u624b\u673a\u53f7\n   *\/\n  public static final String SMS_TYPE_RESETPHONE = \"cache:api:sms_resetphone_\";\n  \/**\n   * \u6ce8\u518c\n   *\/\n  public static final String SMS_TYPE_REG = \"cache:api:sms_reg_\";\n  \/**\n   * \u5de5\u5355\u62a5\u5907\u62a5\u5907\u4eba\u6821\u9a8c\n   *\/\n  public static final String SMS_TYPE_PROJECT = \"cache:api:sms_project_\";\n  \n  \/**\n   * \u670d\u52a1\u5546\u7533\u8bf7\n   *\/\n  public static final String SMS_TYPE_SERVICE = \"cache:api:sms_service_\";\n  \/**\n   * \u7ed1\u5b9a\u8d26\u6237\n   *\/\n  public static final String SMS_TYPE_BIND_PAYACCOUNT = \"cache:api:sms_bing_payaccount_\";\n  \/**\n   * \u670d\u52a1\u5546\u63a5\u5355\u540e\u6838\u9500\u7801\u77ed\u4fe1\u6d88\u606f\uff08\u6d88\u8d39\u8005\uff09\n   *\/\n  public static final String SMS_TYPE_SERVICE_HX = \"cache:api:sms_service_hx_\";\n\n\n  \/**\n   * \u91cd\u7f6e\u5bc6\u7801_token\n   *\/\n  public static final String SMS_TYPE_RESETPWD_TOKEN = \"cache:api:sms_resetpwd:token_\";\n  \/**\n   * \u91cd\u7f6e\u5bc6\u7801_\u624b\u673a\u53f7\n   *\/\n  public static final String SMS_TYPE_RESETPHONE_TOKEN = \"cache:api:sms_resetphone:token_\";\n\n  \/\/\u7701\u5e02\u533a\u5546\u5708\u7f13\u5b58\n  \/**\n   * \u6240\u6709\u7701\u5e02\u533a\n   *\/\n  public static final String SYS_CITY_LIST = \"cache:api:city_list\";\n  \/**\n   * \u5df2\u5f00\u901a\u533a\u57df\u5305\u542b\u5546\u5708\u4fe1\u606f\n   *\/\n  public static final String SYS_CITY_ESC_LIST = \"cache:api:city_esc_list\";\n  \/**\n   * \u6240\u6709\u5df2\u5f00\u901a\u5546\u5708\n   *\/\n  public static final String SYS_ESC_LIST = \"cache:api:esc_list\";\n\n  public static final Integer SYS_CITY_LIST_EXPIRE_TIME_SECONDS = 60 * 60 * 24 * 15;\n\n  \/**\n   * \u9a8c\u8bc1\u7801\u8fc7\u671f\u65f6\u95f4\uff1a5\u5206\u949f\n   *\/\n  public static final Integer CHECKCODE_EXPIRE_TIME_SECONDS = 5 * 60 * 1000;\n\n  \/**\n   * \u9a8c\u8bc1\u7801\u5728redis\u4e2d\u7684\u5b58\u50a8\u65f6\u95f4\uff1a30\u5206\u949f\n   *\/\n  public static final Integer CHECKCODE_EXPIRE_TIME_SAVE_SECONDS = 30 * 60 * 1000;\n\n  \/**\n   * \u5e7f\u544a\u7c7b\u56fe\u7247\n   *\/\n  public static final String CACHE_IMAGE_RES_ADV = \"cache:image_dir:\" + SysConsts.IMAGE_RES_ADV;\n  \/**\n   * \u4f53\u9a8c\u670d\u52a1\u4e2d\u5fc3\u76f8\u5173\u56fe\u7247\n   *\/\n  public static final String CACHE_IMAGE_RES_ESC = \"cache:image_dir:\" + SysConsts.IMAGE_RES_ESC;\n  \/**\n   * \u54c1\u724c\u5e97\u94fa\u76f8\u5173\u56fe\u7247\n   *\/\n  public static final String CACHE_IMAGE_RES_SHOP = \"cache:image_dir:\" + SysConsts.IMAGE_RES_SHOP;\n  \/**\n   * \u4ea7\u54c1\u76f8\u5173\u56fe\u7247\n   *\/\n  public static final String CACHE_IMAGE_RES_PRODUCT = \"cache:image_dir:\" + SysConsts.IMAGE_RES_PRODUCT;\n  \/**\n   * \u5176\u4ed6\u56fe\u6807\/logo\u76f8\u5173\u56fe\u7247\n   *\/\n  public static final String CACHE_IMAGE_RES_ICON = \"cache:image_dir:\" + SysConsts.IMAGE_RES_ICON;\n  \/**\n   * \u7a0b\u5e8f\u4f7f\u7528\u9759\u6001\u6587\u4ef6\u8d44\u6e90\n   *\/\n  public static final String CACHE_IMAGE_RES_STATIC = \"cache:image_dir:\" + SysConsts.IMAGE_RES_STATIC;\n\n  \/**\n   * \u5546\u54c1\u5206\u7c7b\u4fdd\u5b58\n   *\/\n  public static final String CACHE_GOODS_CATE = \"cache:goodscate\";\n  \/**\n   * \u5546\u54c1\u5206\u7c7b\u4fdd\u5b58\u8fc7\u671f\u65f6\u95f4\n   *\/\n  public static final Integer CACHE_GOODS_CATE_EXPIRE_TIME = 60 * 10;\n\n  \/**\n   * \u54c1\u724c\u4fdd\u5b58\n   *\/\n  public static final String CACHE_GOODS_BRAND = \"cache:goodsbrand\";\n\n\n  \/**\n   * \u5e73\u53f0\u54c1\u724c\u4fdd\u5b58\n   *\/\n  public static final String CACHE_GOODS_BRAND_PLATFORM = \"cache:goodsbrand:platform\";\n\n  \/**\n   * \u5546\u5bb6\u54c1\u724c\u4fdd\u5b58\n   *\/\n  public static final String CACHE_GOODS_BRAND_SHOP = \"cache:goodsbrand:shop\";\n\n  \/**\n   * \u54c1\u724c\u4fdd\u5b58\u8fc7\u671f\u65f6\u95f4\n   *\/\n  public static final Integer CACHE_GOODS_BRAND_EXPIRE_TIME = 10 * 60;\n\n  public static final String CACHE_P_USERINFO = \"cache:piduserinfo\";\n\n\n  public static final String CACHE_ORDER_UN_PAY = \"cache:order:unpay\";\n  public static final Long CACHE_ORDER_UN_PAY_EXPIRE_TIME = 24 * 60 * 60 * 1000L;\n\n\n  public static final String CACHE_ORDER_COMMIT = \"cache:commit:order:userid_\";\n  public static final Long CACHE_ORDER_COMMIT_EXPIRE_TIME = 3 * CACHE_ORDER_UN_PAY_EXPIRE_TIME;\n\n\n  public static final String CACHE_WORKBENCH_UPDATE_MAX_INTEGRATL = \"cache:workbeanch:updatemaxintegratl:userid_\";\n\n  public static final Long CACHE_SERVICE_EXPIRE_TIME = 30 * 24 * 60 * 60 * 1000L ;\n\n  public static final Integer CACHE_P_USERINFO_EXPIRE_TIME = 30 * 60;\n\n\n  public static final String CACHE_RANDOM_CATE_LIST = \"cache:random_cate:list\";\n\n\n  public static final String CACHE_TAKE_ORDER = \"cache:take_order:shop_\";\n\n\n  public static final String CACHE_SHOP_GOODS_PLUS_VOLUME = \"cache:shop_goods:plusVolume\";\n\n\n  public static final String CACHE_SHOP_INFO_PLUS_VOLUME = \"cache:shop_info:plusVolume\";\n\n\n  public static final String CACHE_SYS_TEMPLATE_CACHE = \"cache:sms_template:\";\n\n\n  public static final String CACHE_TOKEN = \"cache:token:\";\n  \n  public static final String CACHE_SHOP_IMMEDIATELY_COMMIT = \"cache:shop:immediately:commit:userid_\";\n  \n  public static final Long CACHE_SHOP_IMMEDIATELY_COMMIT_EXPIRE_TIME = 10000L;\n\n\n}\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8be6\u89e3Redis\u4e2dkey\u7684\u547d\u540d\u89c4\u8303&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-201517","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=201517"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201517\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}