1.0.7 • Published 2 years ago

km-queue-cache v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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)
});
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago