mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 00:56:37 +08:00
缓存框架
This commit is contained in:
@@ -3,6 +3,8 @@ import type {
|
||||
AdminUser,
|
||||
AuthSource,
|
||||
AuthSourceRequest,
|
||||
CacheConfig,
|
||||
CacheStatus,
|
||||
CreateScheduleRequest,
|
||||
CreateSystemConfigRequest,
|
||||
CreateTemplateRequest,
|
||||
@@ -28,7 +30,7 @@ import type {
|
||||
UpdateUserStatusRequest,
|
||||
} from './types';
|
||||
|
||||
export type { AdminUser } from './types';
|
||||
export type { AdminUser, CacheStatus, CacheConfig } from './types';
|
||||
|
||||
/**
|
||||
* 管理员服务
|
||||
@@ -133,7 +135,7 @@ export class AdminService extends BaseService {
|
||||
}): Promise<{ success: boolean; log: string; error: string }> {
|
||||
return this.post<{ success: boolean; log: string; error: string }>('/system-configs/smtp/test', request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有已存在的文件业务类型及默认内置类型列表
|
||||
* @returns 业务类型列表
|
||||
@@ -506,4 +508,27 @@ export class AdminService extends BaseService {
|
||||
static async deleteTemplate(key: string): Promise<void> {
|
||||
return this.delete<void>(`/templates/${ key }`);
|
||||
}
|
||||
|
||||
// ==================== 磁盘缓存管理 ====================
|
||||
|
||||
/**
|
||||
* 获取磁盘缓存状态与当前统计数据
|
||||
*/
|
||||
static async getCacheStatus(): Promise<CacheStatus> {
|
||||
return this.get<CacheStatus>('/cache/status');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新磁盘缓存策略配置
|
||||
*/
|
||||
static async updateCacheConfig(config: CacheConfig): Promise<void> {
|
||||
return this.post<void>('/cache/config', config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键清空所有磁盘缓存数据
|
||||
*/
|
||||
static async clearCache(): Promise<void> {
|
||||
return this.post<void>('/cache/clear');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,6 @@ export type {
|
||||
Schedule,
|
||||
CreateScheduleRequest,
|
||||
UpdateScheduleRequest,
|
||||
CacheStatus,
|
||||
CacheConfig,
|
||||
} from './types';
|
||||
|
||||
@@ -438,3 +438,36 @@ export interface DatabaseInfo {
|
||||
/** 数据库版本字符串 */
|
||||
version: string;
|
||||
}
|
||||
|
||||
// ==================== 缓存管理 ====================
|
||||
|
||||
/**
|
||||
* 缓存状态信息
|
||||
*/
|
||||
export interface CacheStatus {
|
||||
/** 缓存文件总大小(字节) */
|
||||
total_size: number;
|
||||
/** 缓存 Key 数量 */
|
||||
keys_count: number;
|
||||
/** 最大容量限制 (MB) */
|
||||
max_size_mb: number;
|
||||
/** 过期时间 (分钟) */
|
||||
ttl_minutes: number;
|
||||
/** 是否启用 LRU 淘汰 */
|
||||
lru_enabled: boolean;
|
||||
/** 缓存目录基准路径 */
|
||||
base_path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存配置请求参数
|
||||
*/
|
||||
export interface CacheConfig {
|
||||
/** 最大容量限制 (MB) */
|
||||
max_size_mb: number;
|
||||
/** 过期时间 (分钟) */
|
||||
ttl_minutes: number;
|
||||
/** 是否启用 LRU 淘汰 */
|
||||
lru_enabled: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user