(ttl: string)
| 96 | } |
| 97 | |
| 98 | function parseTtlString(ttl: string): number { |
| 99 | const match = ttl.match(/^(\d+)(s|m|h)$/); |
| 100 | if (!match) return 5 * 60 * 1000; |
| 101 | const val = Number.parseInt(match[1], 10); |
| 102 | const unit = match[2]; |
| 103 | switch (unit) { |
| 104 | case "s": |
| 105 | return val * 1000; |
| 106 | case "m": |
| 107 | return val * 60 * 1000; |
| 108 | case "h": |
| 109 | return val * 3600 * 1000; |
| 110 | default: |
| 111 | return 5 * 60 * 1000; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | function resolveConfigValue<T>( |
| 116 | cfg: Record<string, unknown> | undefined, |