/** * 基础缓存使用示例 */ import { CacheService } from '../index'; interface User { id: string; name: string; email: string; profile: { bio: string; avatar: string; }; } interface Post { id: string; title: string; content: string; authorId: string; createdAt: Date; } declare class UserRepository { findOne(id: string): Promise; findMany(ids: string[]): Promise; findAll(): Promise; save(user: Partial): Promise; delete(id: string): Promise; } declare class PostRepository { findByAuthor(authorId: string): Promise; } /** * 用户服务示例 */ export declare class UserService { private cacheService; private userRepository; constructor(cacheService: CacheService, userRepository: UserRepository); getUser(id: string): Promise; getUserProfile(id: string): Promise; getUserData(id: string): Promise; getUsersBatch(ids: string[]): Promise; updateUser(id: string, data: Partial): Promise; deleteUser(id: string): Promise; invalidateAllProfiles(): Promise; cacheLargeData(id: string): Promise; getLargeData(id: string): Promise; } /** * 文章服务示例 - 展示依赖使用 */ export declare class PostService { private cacheService; private postRepository; constructor(cacheService: CacheService, postRepository: PostRepository); getPostsByAuthor(authorId: string): Promise; getFeaturedPosts(): Promise; private getConfigVersion; } /** * 缓存统计和监控示例 */ export declare class CacheMonitoringService { private cacheService; constructor(cacheService: CacheService); getCacheStats(): import("../index").CacheStats; resetStats(): void; startMonitoring(intervalMs?: number): void; } /** * 使用示例 */ declare function demonstrateCacheUsage(): Promise; export { demonstrateCacheUsage };