cachejs-data

1.0.6 • Public • Published

cache-data

Cache data in server. This data can be response from Endpoint API, array, text or others types.

Install

npm install cachejs-data

Usage

const Cache = require('cachejs-data')
const cache = new Cache({minToCache: 5})
const cacheKey = 'home-requests'

// Insert item in cache:
cache.insert(cacheKey, [req1: {results: [{id: 1, title: '...'}, {id: 2, title: '...'}]}])

// Remove item from cache:
cache.remove(cacheKey)

// Verify if exists cache key:
cache.exists(cacheKey)

// Verify if is expired:
cache.isExpired(cacheKey)

// Get from cache:
cache.get(cacheKey)

License

MIT © Piero Ribeiro

Package Sidebar

Install

npm i cachejs-data

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

3.95 kB

Total Files

5

Last publish

Collaborators

  • pieroribeiro
  • webmaster-n4w-io