mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-04-19 13:42:44 +08:00
feat: 新增对话数据缓存管理模块,优化统计数据读取性能
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user