(record: WhoisRecord)
| 371 | return null; |
| 372 | } |
| 373 | |
| 374 | return cache; |
| 375 | } |
| 376 | |
| 377 | private async saveWhoisRecord(record: WhoisRecord) { |
| 378 | if (!this.db) return; |
| 379 | |
| 380 | // 保存到缓存 |
| 381 | this.db.data.cache[record.domain.toLowerCase()] = record; |
| 382 | |
| 383 | // 保存到历史 |
| 384 | this.db.data.history.unshift(record); |
| 385 | |
| 386 | // 限制历史记录数量 |
| 387 | const maxHistory = this.db.data.settings.maxHistory || 100; |
| 388 | if (this.db.data.history.length > maxHistory) { |
| 389 | this.db.data.history = this.db.data.history.slice(0, maxHistory); |
| 390 | } |
| 391 | |
| 392 | await this.db.write(); |
no test coverage detected