feat: 新增对话数据缓存管理模块,优化统计数据读取性能

This commit is contained in:
digua
2026-03-29 11:55:15 +08:00
committed by digua
parent bfca7ff133
commit 211a8110b0
17 changed files with 298 additions and 45 deletions

View File

@@ -8,7 +8,8 @@ import * as fs from 'fs'
import * as path from 'path'
import type { ParseResult } from '../../../src/types/base'
import { migrateDatabase, needsMigration, CURRENT_SCHEMA_VERSION } from './migrations'
import { getDatabaseDir, ensureDir } from '../paths'
import { getDatabaseDir, getCacheDir, ensureDir } from '../paths'
import { deleteSessionCache } from './sessionCache'
/**
* 获取数据库目录
@@ -341,6 +342,7 @@ export function deleteSession(sessionId: string): boolean {
if (fs.existsSync(shmPath)) {
fs.unlinkSync(shmPath)
}
deleteSessionCache(sessionId, getCacheDir())
return true
} catch (error) {
console.error('[Database] Failed to delete session:', error)