cachest

0.0.7 • Public • Published

cachest

NPM version Build Status NPM downloads Coverage Status gzip

Cache data based on localstorage in browser, expire property is provided.

Install

npm i cachest

Usage

import cachest from 'cachest';

or

const cachest = require('cachest');

API

.set

Assign value to key with expire time,if expire is not defined, keep the value until to be removed.

Params

  • key {String}: The key of the property to save.
  • value {any}: The content to save.
  • expire {Number}: Expire time, ms as unit

.get

Return the value of key.

Params

  • key {String}: The key of the property to get.
  • return {*}

.del

Remove the value of key.

Params

  • key {String}: The key of the property to remove.

.clear

Clear all saved value.

.keys

Get the keys not expired.

  • return {Array}

.size

return {Number}

Length of keys.

.isExpire

Check if the key is expired, return true if key is not existed.

Params

  • key {String}: The key of the property to check.
  • return {Boolean}

License

Copyright © 2018, ZiQiangWang. Released under the MIT License.

Package Sidebar

Install

npm i cachest

Weekly Downloads

0

Version

0.0.7

License

MIT

Unpacked Size

12.7 kB

Total Files

10

Last publish

Collaborators

  • wangziqiang