native-update
Version:
Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.
73 lines (72 loc) • 1.66 kB
TypeScript
import type { BundleInfo } from '../definitions';
/**
* Manages caching with expiration for various data types
*/
export declare class CacheManager {
private readonly logger;
private readonly configManager;
private filesystem;
private memoryCache;
private readonly CACHE_DIR;
constructor();
/**
* Initialize cache manager
*/
initialize(): Promise<void>;
/**
* Set cache entry with expiration
*/
set<T>(key: string, data: T, ttlMs?: number): Promise<void>;
/**
* Get cache entry
*/
get<T>(key: string): Promise<T | null>;
/**
* Check if cache entry exists and is valid
*/
has(key: string): Promise<boolean>;
/**
* Remove cache entry
*/
remove(key: string): Promise<void>;
/**
* Clear all cache
*/
clear(): Promise<void>;
/**
* Clean expired cache entries
*/
cleanExpiredCache(): Promise<void>;
/**
* Get cache statistics
*/
getStats(): Promise<{
memoryEntries: number;
fileEntries: number;
totalSize: number;
}>;
/**
* Cache bundle metadata
*/
cacheBundleMetadata(bundle: BundleInfo): Promise<void>;
/**
* Get cached bundle metadata
*/
getCachedBundleMetadata(bundleId: string): Promise<BundleInfo | null>;
/**
* Check if data should be persisted to filesystem
*/
private shouldPersist;
/**
* Persist cache entry to file
*/
private persistToFile;
/**
* Load cache entry from file
*/
private loadFromFile;
/**
* Remove cache file
*/
private removeFile;
}