(timeStr?: string)
| 82 | |
| 83 | const time = timeStr.toLowerCase(); |
| 84 | const num = parseInt(time) || 0; |
| 85 | |
| 86 | if (time.includes('d')) return num * 86400; |
| 87 | if (time.includes('h')) return num * 3600; |
| 88 | if (time.includes('m')) return num * 60; |
| 89 | if (time.includes('s')) return num; |
| 90 | |
| 91 | return 0; // 默认永久 |
| 92 | } |
| 93 | |
| 94 | // ==================== 缓存管理器 ==================== |
| 95 | type CacheData = { |
| 96 | cache: Record<string, any>; |
| 97 | }; |
| 98 | |
| 99 | class CacheManager { |