MemKey_Guild.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. namespace loyalsoft;
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7. */
  8. /**
  9. * Description of MemKey_Guild
  10. *
  11. * @author cyzhao
  12. */
  13. class MemKey_Guild
  14. {
  15. //
  16. // <editor-fold defaultstate="collapsed" desc=" 辅助方法 ">
  17. //
  18. /**
  19. * @return bool 是否使用短名称
  20. */
  21. private static function bUseShort()
  22. {
  23. // return true; # 全部启用
  24. return defined('GAME_ONLINE') and GAME_ONLINE;
  25. }
  26. /**
  27. * key前缀
  28. * @param int $zoneid 分区id
  29. * @param string $uid
  30. * @return string
  31. */
  32. private static function Key_($zoneid, $uid)
  33. {
  34. return self::bUseShort() ? 'u-' . $uid . '-' . $zoneid : 'user-' . $uid . '-zone' . $zoneid;
  35. }
  36. // </editor-fold>
  37. /**
  38. * 获取玩家公会信息
  39. * @param type $zoneid
  40. * @return string
  41. */
  42. public static function getUserGuildInfo($uid, $zoneid)
  43. {
  44. return self::Key_($zoneid, $uid) . "-guild";
  45. }
  46. /**
  47. * 公会列表缓存
  48. * @param type $page
  49. * @param type $zoneid
  50. * @return type
  51. */
  52. public static function guildListCache($page, $zoneid)
  53. {
  54. return "cache-guild-list" . "-zone" . $zoneid . $page;
  55. }
  56. /**
  57. * 推荐公会列表缓存
  58. * @return string
  59. */
  60. static function guildRecommendationCache($zoneid)
  61. {
  62. return "cache-guild-recommendation" . "-zone" . $zoneid;
  63. }
  64. /**
  65. * 推荐公会队列
  66. * @return string
  67. */
  68. static function constGuildRecommendationQueue($zoneid)
  69. {
  70. return "guild-recommendation-queue" . "-zone" . $zoneid;
  71. }
  72. /**
  73. * 获取公会信息
  74. */
  75. static function getGuildInfo($gid, $zoneid)
  76. {
  77. return "guild-" . $gid . "-zone" . $zoneid;
  78. }
  79. /**
  80. * 创建公会ID时使用的锁
  81. * 代码在同一个方法中执行添加和删除key值的操作 应该不用分区
  82. * @return string
  83. */
  84. static function constCreateGuildIDLock()
  85. {
  86. return "guild-lock-createid";
  87. }
  88. /**
  89. * 获取当前最大公会ID,
  90. * @return string
  91. */
  92. static function constGetCurrentMaxGuildID($zoneid)
  93. {
  94. return "currentmaxguildid" . "-zone" . $zoneid;
  95. }
  96. /**
  97. * 【哈希】捐献请求记录
  98. * @return string
  99. */
  100. static function CacheGuildDonate($guildId, $zoneid)
  101. {
  102. return "guild-donate-" . $guildId . "-zone" . $zoneid;
  103. }
  104. /**
  105. * 【LIST】捐献者记录
  106. * @return string
  107. */
  108. static function UserDonateRecordList($guildId, $index, $zoneid)
  109. {
  110. return "guild-donor-" . $guildId . "-" . $index . "-zone" . $zoneid;
  111. }
  112. /**
  113. * 【LIST】除了捐献之外的日志
  114. * @return string
  115. */
  116. static function constGuildJournal($guildId, $zoneid)
  117. {
  118. return "guild-journal-" . $guildId . "-zone" . $zoneid;
  119. }
  120. /**
  121. * [hash]
  122. */
  123. static function constvsFightInvite($guildId, $zoneid)
  124. {
  125. return "guild-fightInvite-" . $guildId . "-zone" . $zoneid;
  126. }
  127. }