一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|數(shù)據(jù)庫技術(shù)|

服務(wù)器之家 - 數(shù)據(jù)庫 - Redis - 詳解Redis中key的命名規(guī)范和值的命名規(guī)范

詳解Redis中key的命名規(guī)范和值的命名規(guī)范

2021-02-22 17:12詩水人間 Redis

這篇文章主要介紹了詳解Redis中key的命名規(guī)范和值的命名規(guī)范,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

數(shù)據(jù)庫中得熱點(diǎn)數(shù)據(jù)key命名慣例

  表名:主鍵名:主鍵值:字段名
例如 user:id:0001:name
例如 user:id:0002:name
例如 order:id:s2002:price

上面的key對(duì)應(yīng)的值則可以是

存放的方式 key value 優(yōu)點(diǎn)
單獨(dú)的key:value形式 order:id:s2002:price 2000 方便簡單的操作,例如incr自增或自減
json格式 user:id:0001 {id:0001,name:"張三"} 方便一次性存和取數(shù)據(jù),但是不方便更新數(shù)據(jù)

redis 緩存 key常量命名規(guī)則示例

 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package com.awj.mall.restfulapi.common.consts;
 
public class CacheConsts {
 
  // 短信驗(yàn)證碼類型
  /**
   * 登錄
   */
  public static final String SMS_TYPE_LOGIN = "cache:api:sms_login_";
  /**
   * 重置密碼
   */
  public static final String SMS_TYPE_RESETPWD = "cache:api:sms_resetpwd_";
  /**
   * 重置手機(jī)號(hào)
   */
  public static final String SMS_TYPE_RESETPHONE = "cache:api:sms_resetphone_";
  /**
   * 注冊(cè)
   */
  public static final String SMS_TYPE_REG = "cache:api:sms_reg_";
  /**
   * 工單報(bào)備報(bào)備人校驗(yàn)
   */
  public static final String SMS_TYPE_PROJECT = "cache:api:sms_project_";
  
  /**
   * 服務(wù)商申請(qǐng)
   */
  public static final String SMS_TYPE_SERVICE = "cache:api:sms_service_";
  /**
   * 綁定賬戶
   */
  public static final String SMS_TYPE_BIND_PAYACCOUNT = "cache:api:sms_bing_payaccount_";
  /**
   * 服務(wù)商接單后核銷碼短信消息(消費(fèi)者)
   */
  public static final String SMS_TYPE_SERVICE_HX = "cache:api:sms_service_hx_";
 
 
  /**
   * 重置密碼_token
   */
  public static final String SMS_TYPE_RESETPWD_TOKEN = "cache:api:sms_resetpwd:token_";
  /**
   * 重置密碼_手機(jī)號(hào)
   */
  public static final String SMS_TYPE_RESETPHONE_TOKEN = "cache:api:sms_resetphone:token_";
 
  //省市區(qū)商圈緩存
  /**
   * 所有省市區(qū)
   */
  public static final String SYS_CITY_LIST = "cache:api:city_list";
  /**
   * 已開通區(qū)域包含商圈信息
   */
  public static final String SYS_CITY_ESC_LIST = "cache:api:city_esc_list";
  /**
   * 所有已開通商圈
   */
  public static final String SYS_ESC_LIST = "cache:api:esc_list";
 
  public static final Integer SYS_CITY_LIST_EXPIRE_TIME_SECONDS = 60 * 60 * 24 * 15;
 
  /**
   * 驗(yàn)證碼過期時(shí)間:5分鐘
   */
  public static final Integer CHECKCODE_EXPIRE_TIME_SECONDS = 5 * 60 * 1000;
 
  /**
   * 驗(yàn)證碼在redis中的存儲(chǔ)時(shí)間:30分鐘
   */
  public static final Integer CHECKCODE_EXPIRE_TIME_SAVE_SECONDS = 30 * 60 * 1000;
 
  /**
   * 廣告類圖片
   */
  public static final String CACHE_IMAGE_RES_ADV = "cache:image_dir:" + SysConsts.IMAGE_RES_ADV;
  /**
   * 體驗(yàn)服務(wù)中心相關(guān)圖片
   */
  public static final String CACHE_IMAGE_RES_ESC = "cache:image_dir:" + SysConsts.IMAGE_RES_ESC;
  /**
   * 品牌店鋪相關(guān)圖片
   */
  public static final String CACHE_IMAGE_RES_SHOP = "cache:image_dir:" + SysConsts.IMAGE_RES_SHOP;
  /**
   * 產(chǎn)品相關(guān)圖片
   */
  public static final String CACHE_IMAGE_RES_PRODUCT = "cache:image_dir:" + SysConsts.IMAGE_RES_PRODUCT;
  /**
   * 其他圖標(biāo)/logo相關(guān)圖片
   */
  public static final String CACHE_IMAGE_RES_ICON = "cache:image_dir:" + SysConsts.IMAGE_RES_ICON;
  /**
   * 程序使用靜態(tài)文件資源
   */
  public static final String CACHE_IMAGE_RES_STATIC = "cache:image_dir:" + SysConsts.IMAGE_RES_STATIC;
 
  /**
   * 商品分類保存
   */
  public static final String CACHE_GOODS_CATE = "cache:goodscate";
  /**
   * 商品分類保存過期時(shí)間
   */
  public static final Integer CACHE_GOODS_CATE_EXPIRE_TIME = 60 * 10;
 
  /**
   * 品牌保存
   */
  public static final String CACHE_GOODS_BRAND = "cache:goodsbrand";
 
 
  /**
   * 平臺(tái)品牌保存
   */
  public static final String CACHE_GOODS_BRAND_PLATFORM = "cache:goodsbrand:platform";
 
  /**
   * 商家品牌保存
   */
  public static final String CACHE_GOODS_BRAND_SHOP = "cache:goodsbrand:shop";
 
  /**
   * 品牌保存過期時(shí)間
   */
  public static final Integer CACHE_GOODS_BRAND_EXPIRE_TIME = 10 * 60;
 
  public static final String CACHE_P_USERINFO = "cache:piduserinfo";
 
 
  public static final String CACHE_ORDER_UN_PAY = "cache:order:unpay";
  public static final Long CACHE_ORDER_UN_PAY_EXPIRE_TIME = 24 * 60 * 60 * 1000L;
 
 
  public static final String CACHE_ORDER_COMMIT = "cache:commit:order:userid_";
  public static final Long CACHE_ORDER_COMMIT_EXPIRE_TIME = 3 * CACHE_ORDER_UN_PAY_EXPIRE_TIME;
 
 
  public static final String CACHE_WORKBENCH_UPDATE_MAX_INTEGRATL = "cache:workbeanch:updatemaxintegratl:userid_";
 
  public static final Long CACHE_SERVICE_EXPIRE_TIME = 30 * 24 * 60 * 60 * 1000L ;
 
  public static final Integer CACHE_P_USERINFO_EXPIRE_TIME = 30 * 60;
 
 
  public static final String CACHE_RANDOM_CATE_LIST = "cache:random_cate:list";
 
 
  public static final String CACHE_TAKE_ORDER = "cache:take_order:shop_";
 
 
  public static final String CACHE_SHOP_GOODS_PLUS_VOLUME = "cache:shop_goods:plusVolume";
 
 
  public static final String CACHE_SHOP_INFO_PLUS_VOLUME = "cache:shop_info:plusVolume";
 
 
  public static final String CACHE_SYS_TEMPLATE_CACHE = "cache:sms_template:";
 
 
  public static final String CACHE_TOKEN = "cache:token:";
  
  public static final String CACHE_SHOP_IMMEDIATELY_COMMIT = "cache:shop:immediately:commit:userid_";
  
  public static final Long CACHE_SHOP_IMMEDIATELY_COMMIT_EXPIRE_TIME = 10000L;
 
 
}

到此這篇關(guān)于詳解Redis中key的命名規(guī)范和值的命名規(guī)范的文章就介紹到這了,更多相關(guān)Redis key命名規(guī)范內(nèi)容請(qǐng)搜索服務(wù)器之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持服務(wù)器之家!

原文鏈接:https://blog.csdn.net/qq_41813208/article/details/107602121

延伸 · 閱讀

精彩推薦
  • RedisRedis 事務(wù)知識(shí)點(diǎn)相關(guān)總結(jié)

    Redis 事務(wù)知識(shí)點(diǎn)相關(guān)總結(jié)

    這篇文章主要介紹了Redis 事務(wù)相關(guān)總結(jié),幫助大家更好的理解和學(xué)習(xí)使用Redis,感興趣的朋友可以了解下...

    AsiaYe8232021-07-28
  • RedisRedis全量復(fù)制與部分復(fù)制示例詳解

    Redis全量復(fù)制與部分復(fù)制示例詳解

    這篇文章主要給大家介紹了關(guān)于Redis全量復(fù)制與部分復(fù)制的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Redis爬蟲具有一定的參考學(xué)習(xí)...

    豆子先生5052019-11-27
  • Redisredis實(shí)現(xiàn)排行榜功能

    redis實(shí)現(xiàn)排行榜功能

    排行榜在很多地方都能使用到,redis的zset可以很方便地用來實(shí)現(xiàn)排行榜功能,本文就來簡單的介紹一下如何使用,具有一定的參考價(jià)值,感興趣的小伙伴們...

    乘月歸5022021-08-05
  • RedisRedis的配置、啟動(dòng)、操作和關(guān)閉方法

    Redis的配置、啟動(dòng)、操作和關(guān)閉方法

    今天小編就為大家分享一篇Redis的配置、啟動(dòng)、操作和關(guān)閉方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧 ...

    大道化簡5312019-11-14
  • RedisRedis如何實(shí)現(xiàn)數(shù)據(jù)庫讀寫分離詳解

    Redis如何實(shí)現(xiàn)數(shù)據(jù)庫讀寫分離詳解

    Redis的主從架構(gòu),能幫助我們實(shí)現(xiàn)讀多,寫少的情況,下面這篇文章主要給大家介紹了關(guān)于Redis如何實(shí)現(xiàn)數(shù)據(jù)庫讀寫分離的相關(guān)資料,文中通過示例代碼介紹...

    羅兵漂流記6092019-11-11
  • Redisredis 交集、并集、差集的具體使用

    redis 交集、并集、差集的具體使用

    這篇文章主要介紹了redis 交集、并集、差集的具體使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友...

    xiaojin21cen10152021-07-27
  • Redisredis中如何使用lua腳本讓你的靈活性提高5個(gè)逼格詳解

    redis中如何使用lua腳本讓你的靈活性提高5個(gè)逼格詳解

    這篇文章主要給大家介紹了關(guān)于redis中如何使用lua腳本讓你的靈活性提高5個(gè)逼格的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具...

    一線碼農(nóng)5812019-11-18
  • Redis詳解Redis復(fù)制原理

    詳解Redis復(fù)制原理

    與大多數(shù)db一樣,Redis也提供了復(fù)制機(jī)制,以滿足故障恢復(fù)和負(fù)載均衡等需求。復(fù)制也是Redis高可用的基礎(chǔ),哨兵和集群都是建立在復(fù)制基礎(chǔ)上實(shí)現(xiàn)高可用的...

    李留廣10222021-08-09
主站蜘蛛池模板: 大奶喷水| 好爽视频| 国产午夜精品理论片 | 亚洲欧美日韩特级毛片 | 国产欧美日韩视频在线观看一区二区 | 国产午夜永久福利视频在线观看 | 美女在线看永久免费网址 | 99在线精品视频 | 2018天天弄| 扒开女人下面使劲桶屁股动漫 | 亚洲国产欧美另类va在线观看 | 欧美腐剧mm在线观看 | 国产传媒在线播放 | 国产成+人+综合+亚洲欧美丁香花 | 久久天天躁狠狠躁夜夜躁 | 国产一线天| 黑人与老女人做受 | 狠狠色96视频| 免费被黄网站在观看 | 男女车车好快的车车免费网站 | 香港论理午夜电影网 | 男人搡女人视频免费看 | 日韩精品中文字幕久久 | 日韩a无吗一区二区三区 | 成人综合久久综合 | 日产免费自线一二区 | 久久久无码精品无码国产人妻丝瓜 | 精品久久免费视频 | 寡妇快点好大好爽视频 | 九九久久精品 | 无人区在线观看免费完整版免费 | 精品无码久久久久久久动漫 | 国产精品对白刺激久久久 | 亚洲精品影视 | 国产原创一区二区 | 久久精品AV一区二区无码 | 法国女佣系列在线播放 | 天堂8在线天堂资源bt | haodiaose在线精品免费观看 | 毛片在线看网站 | 国产日韩精品一区二区在线观看 |