km-queue-cache

1.0.7 • Public • Published

About

This package is for making cache in queue.

Install

const kmQueueCache = require('km-queue-cache');

const queueMaxSize = 100;
const cacheStorage = './my-data/data.json';

const myCache = new kmQueueCache(cacheStorage, queueMaxSize);

Usage

Push Data

const student = {
    "id": 6, 
    "name": "Kiran Mulmi"
}

myCache.push(student).then(response => {
    console.log(response);
});

Fetch All Data

myCache.getAllQueueData().then(response => {
    console.log(response); // All Results
});

Filter Or Get All Data

myCache.filter(student => student.id === 6).then(response => {
    console.log(response)
});

myCache.getAll("id", 6).then(response => {
    console.log(response)
});

Find or Get Data

myCache.find(student => student.name === "kiran mulmi").then(response => {
    console.log(response);
});

myCache.get("name", "kiran mulmi").then(response => {
    console.log(response);
});

Remove Data

myCache.remove("id", 6).then(response => {
    console.log(response)
});

Remove All Data

myCache.removeAll().then(response => {
    console.log(response)
});

Pop Data

myCache.pop().then(response => {
    console.log(response)
});

Pop First

myCache.popFirst().then(response => {
    console.log(response)
});

Package Sidebar

Install

npm i km-queue-cache

Weekly Downloads

2

Version

1.0.7

License

ISC

Unpacked Size

9.61 kB

Total Files

7

Last publish

Collaborators

  • kiranmulmi