km-queue-cache
v1.0.7
Published
This package is for making cache in queue.
Downloads
3
Maintainers
Readme
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)
});