Files
webman-buildadmin/config/game_hot_cache.php

29 lines
935 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
/**
* 游戏侧热点数据 Redis 缓存(用户 / game_config / game_record
*
* 环境变量见 .env-example 中 GAME_HOT_CACHE_*
*/
$envInt = static function (string $key, int $default): int {
$raw = env($key, null);
if ($raw === null || $raw === '') {
return $default;
}
$n = filter_var($raw, FILTER_VALIDATE_INT);
return ($n === false || $n < 1) ? $default : $n;
};
return [
'enabled' => filter_var(env('GAME_HOT_CACHE_ENABLED', true), FILTER_VALIDATE_BOOLEAN),
/** game_config 行缓存(秒),后台修改会主动删除 */
'ttl_game_config' => $envInt('GAME_HOT_CACHE_TTL_GAME_CONFIG', 86400),
/** game_record 行缓存(秒) */
'ttl_game_record' => $envInt('GAME_HOT_CACHE_TTL_GAME_RECORD', 60),
/** user 行缓存(秒),余额/连胜变更会主动删除 */
'ttl_user' => $envInt('GAME_HOT_CACHE_TTL_USER', 90),
];