0.0.1 • Published 3 years ago
react-native-clcasher-fork v0.0.1
MemoryCache (FORK)
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
import MemoryCache from 'react-native-clcasher/MemoryCache';
MemoryCache.set(url, headers, maxAge)
0.0.1
3 years ago