react-native-clcasher
v1.0.0
Published
clcasher
Downloads
3,096
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-clcasher
Usage
const MemoryCache = require('react-native-clcasher/MemoryCache').default;
MemoryCache.set(url, headers, maxAge)