react-native-memory-cache
v1.0.1
Published
Extended AsyncStorage with expiration check
Downloads
2
Readme
MemoryCache
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
Installation
npm install --save react-native-memory-cache
Usage
const MemoryCache = require('react-native-clcasher/MemoryCache').default;
MemoryCache.set(url, headers, maxAge)