react-native-clcasher

1.0.0 • Public • Published

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 seconds
  • get(key: string) - Returns stored data by key
  • remove(key: string) - Clear data by key
  • multiGet(keys: array) - Get data by keys
  • multiSet(values: object, expires?: seconds) - Store multiple data with expiration time in seconds
  • multiRemove(keys: array) - Clears storage by specified keys
  • flush() - Clear storage
  • isExpired(key: string) - Checks of data expiration
  • getAllKeys() - Returns all stored keys
  • getAllValues() - 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)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2,028
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2,028
  • 0.0.1
    0

Package Sidebar

Install

npm i react-native-clcasher

Weekly Downloads

2,028

Version

1.0.0

License

ISC

Last publish

Collaborators

  • admin_clcorp
  • iegik