| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Module\Game\DCache;
- use App\Module\Farm\Commands\GenerateFarmLandConfigJson;
- use App\Module\LCache\DQueueJob;
- /**
- * 农场土地配置表缓存
- */
- class FarmLandJsonConfig extends DQueueJob
- {
- /**
- * 获取新数据
- *
- * @param array $parameter 参数
- * @return mixed
- */
- static public function getNewData(array $parameter = [])
- {
- try {
- return GenerateFarmLandConfigJson::generateJson();
- } catch (\Exception $e) {
- // 如果生成失败,返回空数组
- return [
- 'generated_ts' => time(),
- 'land_types' => [],
- 'upgrade_paths' => []
- ];
- }
- }
- /**
- * 获取缓存时间(秒)
- *
- * @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 [];
- }
- }
|