Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

idbcache

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Issues
File Explorer

Advanced tools

idbcache

A lscache like api which is based on indexedDB.

    0.3.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
641
decreased by-4.75%

Weekly downloads

Readme

Source

idbcache

This is a module which tries to mimic lscache api, but with indexedDB storage.

Usage

1.) Install the package npm install idbcache

2.) import it in your file.

import idbcache from 'idbcache' OR,

var idbcache = require('idbcache').default

Available API's are -

1.)   set(key, val, time)

Set a value with name 'key' and value 'val' for 'time' minutes.

eg.

idbcache.set('hello', 'world', 2);

This will set the key 'hello' with value 'world' for 2mins.

2.)   get(key)

Can be used to retrieve a value store against a particular key.

eg.
idbcache.get('hello').then(val => console.log(val));

// logs: "world"

Returns:

A promise.

3.)   remove(key)

Can be used to delete a particular key.

eg.
idbcache.remove('hello');

// deletes: Key titled hello from DB.

5.)   flush()

Can be used to flush the entire key-value store.

eg.
idbcache.flush();

Keywords

FAQs

Last updated on 06 Dec 2017

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc