perf: 延长缓存时间至7天以提升性能

优化缓存策略,将缓存时间从10分钟延长至7天,减少API调用频率
This commit is contained in:
2025-08-05 16:05:44 +08:00
parent 2f84227057
commit 7f377fe2f7
2 changed files with 31 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ $apiBaseUrl = 'https://um.com';
$token = '你的tocken';
$websiteId = '你的网站id';
$cacheFile = 'umami_cache.json';
$cacheTime = 600; // 缓存时间为10分钟600秒
$cacheTime = 604800; // 缓存时间为7天604800秒
// 获取当前时间戳(毫秒级)
$currentTimestamp = time() * 1000;

View File

@@ -139,12 +139,42 @@ const BOOKED_STATUS = {
4. 保持价格系数的合理性
## 更新日志
### 2025-08-05
- 优化缓存策略将info.php中的缓存时间从10分钟600秒延长至7天604800秒
- 提升系统性能减少API调用频率
### 2024-02-29
- 初始版本发布
- 实现动态定价系统
- 添加广告位预览功能
- 优化移动端显示效果
## 维护说明
umami的升级后会导致token丢失需要定期的去获取新的token否则会导致无法获取到实时的访问量数据。
token获取POST /api/auth/login
```
{
"username": "your-username",
"password": "your-password"
}
```
如果成功,你应该得到以下类似的响应:
```
{
"token": "eyTMjU2IiwiY...4Q0JDLUhWxnIjoiUE_A",
"user": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"username": "admin",
"role": "admin",
"createdAt": "2000-00-00T00:00:00.000Z",
"isAdmin": true
}
}
```
- 定期更新访问量数据接口
- 监控系统运行状态
- 及时处理异常情况
## 未来计划
- 可在线支付的自助广告系统,绑定对应广告位的动态码,实现全程自助下单并完成广告投放。