MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getCachedResult

Method getCachedResult

whois/whois.ts:352–371  ·  view source on GitHub ↗
(domain: string)

Source from the content-addressed store, hash-verified

350 parseMode: "html",
351 linkPreview: false
352 });
353 }
354 }
355
356 private async getCachedResult(domain: string): Promise<WhoisRecord | null> {
357 if (!this.db) return null;
358
359 const cache = this.db.data.cache[domain.toLowerCase()];
360 if (!cache) return null;
361
362 // 检查缓存是否过期
363 const cacheTime = new Date(cache.queryTime).getTime();
364 const now = Date.now();
365 const cacheHours = this.db.data.settings.cacheHours || 24;
366
367 if (now - cacheTime > cacheHours * 60 * 60 * 1000) {
368 // 缓存过期,删除
369 delete this.db.data.cache[domain.toLowerCase()];
370 await this.db.write();
371 return null;
372 }
373
374 return cache;

Callers 2

handleWhoisMethod · 0.95
handleBatchQueryMethod · 0.95

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected