Cache Storage is a key value storage build on top of AsyncStorage, it uses a combination of memory and AsyncStorage to provide fast responses.
import CacheStorage from 'react-native-cache-storage';
const cacheStorage = new CacheStorage();
setItem(key: string, value: string, ttl?: number): Promise<void>;
- ttl:
- in seconds
- default:
300
- if
0
is informed item will never expire.
getItem(key: string): Promise<string | null>;
multiSet(keyValuePairs: string[][], ttl: number = 300): Promise<void>;
Remove all keys saved in CacheStorage.
clear(): Promise<void>;
Only affect keys saved by CacheStorage