MemKey_Guild.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * Description of MemKey_Guild
  5. *
  6. * @author cyzhao
  7. */
  8. class MemKey_Guild {
  9. //
  10. // <editor-fold defaultstate="collapsed" desc=" 辅助方法 ">
  11. //
  12. /**
  13. * @return bool 是否使用短名称
  14. */
  15. private static function bUseShort() {
  16. // return true; # 全部启用
  17. return match (PLAT) {
  18. Enum_Plat::dev_gwang => false, # dev时不使用
  19. default => true,
  20. };
  21. }
  22. /**
  23. * key前缀
  24. * @param int $zoneid 分区id
  25. * @param string $uid
  26. * @return string
  27. */
  28. private static function Key_($zoneid, $uid) {
  29. return self::bUseShort() ? 'u-' . $uid . '-' . $zoneid : 'user-' . $uid . '-zone' . $zoneid;
  30. }
  31. // </editor-fold>
  32. /**
  33. * 获取玩家公会信息
  34. * @param type $zoneid
  35. * @return string
  36. */
  37. public static function getUserGuildInfo_hash($uid, $zoneid) {
  38. return self::Key_($zoneid, $uid) . "-guild";
  39. }
  40. /**
  41. * 公会列表缓存
  42. * @param type $page
  43. * @param type $zoneid
  44. * @return type
  45. */
  46. public static function guildListCache($page, $zoneid) {
  47. return "cache-guild-list" . "-zone" . $zoneid . $page;
  48. }
  49. // /**
  50. // * 推荐公会列表缓存
  51. // * @return string
  52. // */
  53. // static function guildRecommendationCache($zoneid) {
  54. // return "cache-guild-recommendation" . "-zone" . $zoneid;
  55. // }
  56. //
  57. // /**
  58. // * 推荐公会队列
  59. // * @return string
  60. // */
  61. // static function constGuildRecommendationQueue($zoneid) {
  62. // return "guild-recommendation-queue" . "-zone" . $zoneid;
  63. // }
  64. /**
  65. * 获取公会信息
  66. */
  67. static function getGuildInfo_hash($gid, $zoneid) {
  68. return "guild-" . $gid . "-zone" . $zoneid;
  69. }
  70. /**
  71. * 获取当前最大公会ID,
  72. * @return string
  73. */
  74. static function constGetCurrentMaxGuildID($zoneid) {
  75. return "guild-currentmaxid" . "-zone" . $zoneid;
  76. }
  77. // /**
  78. // * 【哈希】捐献请求记录
  79. // * @return string
  80. // */
  81. // static function CacheGuildDonate($guildId, $zoneid) {
  82. // return "guild-donate-" . $guildId . "-zone" . $zoneid;
  83. // }
  84. //
  85. // /**
  86. // * 【LIST】捐献者记录
  87. // * @return string
  88. // */
  89. // static function UserDonateRecordList($guildId, $index, $zoneid) {
  90. // return "guild-donor-" . $guildId . "-" . $index . "-zone" . $zoneid;
  91. // }
  92. //
  93. // /**
  94. // * 【LIST】除了捐献之外的日志
  95. // * @return string
  96. // */
  97. // static function constGuildJournal($guildId, $zoneid) {
  98. // return "guild-journal-" . $guildId . "-zone" . $zoneid;
  99. // }
  100. }