| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Module\Game\DCache;
- use App\Module\LCache\DQueueJob;
- /**
- * 宠物配置表缓存
- */
- class PetJsonConfig extends DQueueJob
- {
- /**
- * 获取新数据
- *
- * @param array $parameter 参数
- * @return mixed
- */
- static public function getNewData(array $parameter = [])
- {
- // 为了兼容旧版本,返回一个包含所有宠物配置的数据结构
- $petConfigData = PetConfigJsonConfig::getNewData($parameter);
- $petLevelConfigData = PetLevelJsonConfig::getNewData($parameter);
- $petSkillConfigData = PetSkillJsonConfig::getNewData($parameter);
- return [
- 'pet_config' => $petConfigData,
- 'pet_level_config' => $petLevelConfigData,
- 'pet_skill_config' => $petSkillConfigData,
- 'success' => true,
- 'generated_ts' => time(),
- 'message' => '宠物配置已拆分为三个独立文件,请使用各自的缓存类获取'
- ];
- }
- /**
- * 获取缓存时间(秒)
- *
- * @return int
- */
- static public function getTtl(): int
- {
- return 3600; // 1小时
- }
- /**
- * 获取防重复执行时间(秒)
- *
- * @return int
- */
- static public function getPreventDuplication(): int
- {
- return 600; // 10分钟
- }
- /**
- * 获取必需参数索引
- *
- * @return array
- */
- static public function getRequiredArgIndex(): array
- {
- return [];
- }
- }
|