()
| 53 | } |
| 54 | |
| 55 | private save() { |
| 56 | if (!this.cache) return; |
| 57 | try { |
| 58 | const filePath = this.getPath(); |
| 59 | const dir = path.dirname(filePath); |
| 60 | if (!fs.existsSync(dir)) { |
| 61 | fs.mkdirSync(dir, { recursive: true }); |
| 62 | } |
| 63 | fs.writeFileSync(filePath, JSON.stringify(this.cache, null, 2)); |
| 64 | } catch (error) { |
| 65 | debugLogger.warn('Failed to save persistent state:', error); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | get<K extends keyof PersistentStateData>( |
| 70 | key: K, |