capacitor-cors-bypass-enhanced
Version:
Enhanced Capacitor plugin for CORS bypass with HTTP/2, HTTP/3, gRPC, GraphQL, file operations, and advanced networking features. Modular TypeScript definitions for better maintainability.
99 lines • 2.81 kB
TypeScript
/**
* Cache Manager Implementation
* 缓存管理器实现
*/
import type { CacheEntry, CacheStats, CacheOptions, CacheEvictionOptions } from '../types/cache';
import type { CacheManager } from '../types/cache';
export type { CacheManager } from '../types/cache';
/**
* Memory Cache Manager
* 内存缓存管理器
*/
export declare class MemoryCacheManager implements CacheManager {
private cache;
private accessCount;
private accessTime;
private stats;
private maxSize;
private evictionPolicy;
private cleanupInterval?;
constructor(maxSize?: number, // 50MB
evictionOptions?: CacheEvictionOptions);
get(key: string): Promise<CacheEntry | null>;
set(key: string, entry: CacheEntry): Promise<void>;
delete(key: string): Promise<boolean>;
clear(): Promise<void>;
has(key: string): Promise<boolean>;
keys(): Promise<string[]>;
getStats(): Promise<CacheStats>;
cleanup(): Promise<number>;
getSize(): Promise<number>;
/**
* 清理缓存以腾出空间
*/
private evict;
/**
* 根据清理策略排序条目
*/
private sortEntriesForEviction;
/**
* 启动自动清理
*/
private startAutoCleanup;
/**
* 停止自动清理
*/
stopAutoCleanup(): void;
/**
* 销毁缓存管理器
*/
destroy(): void;
}
/**
* LocalStorage Cache Manager
* LocalStorage 缓存管理器
*/
export declare class LocalStorageCacheManager implements CacheManager {
private prefix;
private stats;
constructor(prefix?: string);
get(key: string): Promise<CacheEntry | null>;
set(key: string, entry: CacheEntry): Promise<void>;
delete(key: string): Promise<boolean>;
clear(): Promise<void>;
has(key: string): Promise<boolean>;
keys(): Promise<string[]>;
getStats(): Promise<CacheStats>;
cleanup(): Promise<number>;
getSize(): Promise<number>;
}
/**
* IndexedDB Cache Manager
* IndexedDB 缓存管理器(用于大数据量)
*/
export declare class IndexedDBCacheManager implements CacheManager {
private dbName;
private storeName;
private db;
private stats;
constructor(dbName?: string, storeName?: string);
private getDB;
get(key: string): Promise<CacheEntry | null>;
set(key: string, entry: CacheEntry): Promise<void>;
delete(key: string): Promise<boolean>;
clear(): Promise<void>;
has(key: string): Promise<boolean>;
keys(): Promise<string[]>;
getStats(): Promise<CacheStats>;
cleanup(): Promise<number>;
getSize(): Promise<number>;
/**
* 关闭数据库连接
*/
close(): void;
}
/**
* 创建缓存管理器工厂函数
*/
export declare function createCacheManager(options?: CacheOptions): CacheManager;
//# sourceMappingURL=cache.d.ts.map