@shaaz1000/rn-storage
Version:
A comprehensive storage solution for React Native with encryption, caching, and offline sync
55 lines • 1.34 kB
TypeScript
interface CacheConfig {
expiryTime?: number;
maxSize?: number;
encryptData?: boolean;
}
declare class CacheManager {
private static instance;
private storage;
private config;
private constructor();
/**
* Get CacheManager instance
*/
static getInstance(config?: CacheConfig): CacheManager;
/**
* Update cache configuration
* @param newConfig - New configuration options
*/
updateConfig(newConfig: Partial<CacheConfig>): void;
/**
* Set cache item
* @param key - Cache key
* @param value - Value to cache
* @param customExpiryTime - Optional custom expiry time
*/
set(key: string, value: any, customExpiryTime?: number): Promise<void>;
/**
* Get cache item
* @param key - Cache key
*/
get(key: string): Promise<any>;
/**
* Remove cache item
* @param key - Cache key
*/
remove(key: string): Promise<void>;
/**
* Clear all cache
*/
clear(): Promise<void>;
/**
* Find oldest cache item
*/
private findOldestKey;
/**
* Get current cache size
*/
getCacheSize(): Promise<number>;
/**
* Check if key exists in cache
*/
has(key: string): Promise<boolean>;
}
export default CacheManager;
//# sourceMappingURL=cacheManager.d.ts.map