Code Monkey home page Code Monkey logo

idbcache's Introduction

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();

idbcache's People

Contributors

sach2211 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

gitygity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.