MemKey_Guild.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 defined('GAME_ONLINE') and GAME_ONLINE;
  18. }
  19. /**
  20. * key前缀
  21. * @param int $zoneid 分区id
  22. * @param string $uid
  23. * @return string
  24. */
  25. private static function Key_($zoneid, $uid) {
  26. return self::bUseShort() ? 'u-' . $uid . '-' . $zoneid : 'user-' . $uid . '-zone' . $zoneid;
  27. }
  28. // </editor-fold>
  29. /**
  30. * 获取玩家公会信息
  31. * @param type $zoneid
  32. * @return string
  33. */
  34. public static function getUserGuildInfo($uid, $zoneid) {
  35. return self::Key_($zoneid, $uid) . "-guild";
  36. }
  37. /**
  38. * 公会列表缓存
  39. * @param type $page
  40. * @param type $zoneid
  41. * @return type
  42. */
  43. public static function guildListCache($page, $zoneid) {
  44. return "cache-guild-list" . "-zone" . $zoneid . $page;
  45. }
  46. /**
  47. * 推荐公会列表缓存
  48. * @return string
  49. */
  50. static function guildRecommendationCache($zoneid) {
  51. return "cache-guild-recommendation" . "-zone" . $zoneid;
  52. }
  53. /**
  54. * 推荐公会队列
  55. * @return string
  56. */
  57. static function constGuildRecommendationQueue($zoneid) {
  58. return "guild-recommendation-queue" . "-zone" . $zoneid;
  59. }
  60. /**
  61. * 获取公会信息
  62. */
  63. static function getGuildInfo($gid, $zoneid) {
  64. return "guild-" . $gid . "-zone" . $zoneid;
  65. }
  66. /**
  67. * 创建公会ID时使用的锁
  68. * 代码在同一个方法中执行添加和删除key值的操作 应该不用分区
  69. * @return string
  70. */
  71. static function constCreateGuildIDLock() {
  72. return "guild-lock-createid";
  73. }
  74. /**
  75. * 获取当前最大公会ID,
  76. * @return string
  77. */
  78. static function constGetCurrentMaxGuildID($zoneid) {
  79. return "currentmaxguildid" . "-zone" . $zoneid;
  80. }
  81. /**
  82. * 【哈希】捐献请求记录
  83. * @return string
  84. */
  85. static function CacheGuildDonate($guildId, $zoneid) {
  86. return "guild-donate-" . $guildId . "-zone" . $zoneid;
  87. }
  88. /**
  89. * 【LIST】捐献者记录
  90. * @return string
  91. */
  92. static function UserDonateRecordList($guildId, $index, $zoneid) {
  93. return "guild-donor-" . $guildId . "-" . $index . "-zone" . $zoneid;
  94. }
  95. /**
  96. * 【LIST】除了捐献之外的日志
  97. * @return string
  98. */
  99. static function constGuildJournal($guildId, $zoneid) {
  100. return "guild-journal-" . $guildId . "-zone" . $zoneid;
  101. }
  102. /**
  103. * [hash]
  104. */
  105. static function constvsFightInvite($guildId, $zoneid) {
  106. return "guild-fightInvite-" . $guildId . "-zone" . $zoneid;
  107. }
  108. }