Extended AsyncStorage with expiration check
AsyncStorage can only save data forever. If you want save data for some period of time and clean outdated data - use following API:
set(key: string, value?: mixed, expires?: seconds)
- Stores data by key and expiration time in secondsget(key: string)
- Returns stored data by keyremove(key: string)
- Clear data by keymultiGet(keys: array)
- Get data by keysmultiSet(values: object, expires?: seconds)
- Store multiple data with expiration time in secondsmultiRemove(keys: array)
- Clears storage by specified keysflush()
- Clear storageisExpired(key: string)
- Checks of data expirationgetAllKeys()
- Returns all stored keysgetAllValues()
- Returns all stored serialized values
npm install --save react-native-cacher
const MemoryCache = require('react-native-cacher/MemoryCache');
MemoryCache.set(url, headers, maxAge)