RedisKeyConstant.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package com.sf.constant;
  18. /**
  19. * Redis Key 定义常量类
  20. * 公众号:马丁玩编程,回复:加群,添加马哥微信(备注:12306)获取项目资料
  21. */
  22. public final class RedisKeyConstant {
  23. /**
  24. * 列车基本信息,Key Prefix + 列车ID
  25. */
  26. public static final String TRAIN_INFO = "index12306-ticket-service:train_info:";
  27. /**
  28. * 地区与站点映射查询
  29. */
  30. public static final String REGION_TRAIN_STATION_MAPPING = "index12306-ticket-service:region_train_station_mapping";
  31. /**
  32. * 站点查询分布式锁 Key
  33. */
  34. public static final String LOCK_REGION_TRAIN_STATION_MAPPING = "index12306-ticket-service:lock:region_train_station_mapping";
  35. /**
  36. * 站点查询,Key Prefix + 起始城市_终点城市_日期
  37. */
  38. public static final String REGION_TRAIN_STATION = "index12306-ticket-service:region_train_station:%s_%s";
  39. /**
  40. * 站点查询分布式锁 Key
  41. */
  42. public static final String LOCK_REGION_TRAIN_STATION = "index12306-ticket-service:lock:region_train_station";
  43. /**
  44. * 列车站点座位价格查询,Key Prefix + 列车ID_起始城市_终点城市
  45. */
  46. public static final String TRAIN_STATION_PRICE = "index12306-ticket-service:train_station_price:%s_%s_%s";
  47. /**
  48. * 地区以及车站查询,Key Prefix + ( 车站名称 or 查询方式 )
  49. */
  50. public static final String REGION_STATION = "index12306-ticket-service:region-station:";
  51. /**
  52. * 站点余票查询,Key Prefix + 列车ID_起始站点_终点
  53. */
  54. public static final String TRAIN_STATION_REMAINING_TICKET = "index12306-ticket-service:train_station_remaining_ticket:";
  55. /**
  56. * 列车车厢查询,Key Prefix + 列车ID
  57. */
  58. public static final String TRAIN_CARRIAGE = "index12306-ticket-service:train_carriage:";
  59. /**
  60. * 车厢余票查询,Key Prefix + 列车ID_起始站点_终点
  61. */
  62. public static final String TRAIN_STATION_CARRIAGE_REMAINING_TICKET = "index12306-ticket-service:train_station_carriage_remaining_ticket:";
  63. /**
  64. * 站点详细信息查询,Key Prefix + 列车ID_起始站点_终点
  65. */
  66. public static final String TRAIN_STATION_DETAIL = "index12306-ticket-service:train_station_detail:";
  67. /**
  68. * 列车路线信息查询,Key Prefix + 列车ID
  69. */
  70. public static final String TRAIN_STATION_STOPOVER_DETAIL = "index12306-ticket-service:train_station_stopover_detail:";
  71. /**
  72. * 列车站点缓存
  73. */
  74. public static final String STATION_ALL = "index12306-ticket-service:all_station";
  75. /**
  76. * 列车车厢状态, Key Prefix + 列车 ID + 起始站点 + 目的站点 + 车厢编号
  77. */
  78. public static final String TRAIN_CARRIAGE_SEAT_STATUS = "index12306-ticket-service:train_carriage_seat_status:";
  79. /**
  80. * 用户购票分布式锁 Key
  81. */
  82. public static final String LOCK_PURCHASE_TICKETS = "${unique-name:}index12306-ticket-service:lock:purchase_tickets_%s";
  83. /**
  84. * 用户购票分布式锁 Key v2
  85. */
  86. public static final String LOCK_PURCHASE_TICKETS_V2 = "${unique-name:}index12306-ticket-service:lock:purchase_tickets_%s_%d";
  87. /**
  88. * 获取全部地点集合 Key
  89. */
  90. public static final String QUERY_ALL_REGION_LIST = "index12306-ticket-service:query_all_region_list";
  91. /**
  92. * 列车购买令牌桶,Key Prefix + 列车ID
  93. */
  94. public static final String TICKET_AVAILABILITY_TOKEN_BUCKET = "index12306-ticket-service:ticket_availability_token_bucket:";
  95. /**
  96. * 获取全部地点集合分布式锁 Key
  97. */
  98. public static final String LOCK_QUERY_ALL_REGION_LIST = "index12306-ticket-service:lock:query_all_region_list";
  99. /**
  100. * 获取列车车厢数量集合分布式锁 Key
  101. */
  102. public static final String LOCK_QUERY_CARRIAGE_NUMBER_LIST = "index12306-ticket-service:lock:query_carriage_number_list_%s";
  103. /**
  104. * 获取地区以及站点集合分布式锁 Key
  105. */
  106. public static final String LOCK_QUERY_REGION_STATION_LIST = "index12306-ticket-service:lock:query_region_station_list_%s";
  107. /**
  108. * 获取相邻座位余票分布式锁 Key
  109. */
  110. public static final String LOCK_SAFE_LOAD_SEAT_MARGIN_GET = "index12306-ticket-service:lock:safe_load_seat_margin_%s";
  111. /**
  112. * 列车购买令牌桶加载数据 Key
  113. */
  114. public static final String LOCK_TICKET_AVAILABILITY_TOKEN_BUCKET = "index12306-ticket-service:lock:ticket_availability_token_bucket:%s";
  115. /**
  116. * 令牌获取失败分布式锁 Key
  117. */
  118. public static final String LOCK_TOKEN_BUCKET_ISNULL = "index12306-ticket-service:lock:token-bucket-isnull:%s";
  119. }