node cache

const { NodeDiskStorage } = require('node-disk-storage')
const nds = new NodeDiskStorage()

/**
 * @description set data
 */

;(async () => {
	await nds.set('user', [
		{
			id: 1,
			name: 'Leanne Graham',
			username: 'Bret',
			email: 'Sincere@april.biz',
			address: {
				street: 'Kulas Light',
				suite: 'Apt. 556',
				city: 'Gwenborough',
				zipcode: '92998-3874',
				geo: {
					lat: '-37.3159',
					lng: '81.1496'
				}
			},
			phone: '1-770-736-8031 x56442',
			website: 'hildegard.org',
			company: {
				name: 'Romaguera-Crona',
				catchPhrase: 'Multi-layered client-server neural-net',
				bs: 'harness real-time e-markets'
			}
		},
		{
			id: 2,
			name: 'Ervin Howell',
			username: 'Antonette',
			email: 'Shanna@melissa.tv',
			address: {
				street: 'Victor Plains',
				suite: 'Suite 879',
				city: 'Wisokyburgh',
				zipcode: '90566-7771',
				geo: {
					lat: '-43.9509',
					lng: '-34.4618'
				}
			},
			phone: '010-692-6593 x09125',
			website: 'anastasia.net',
			company: {
				name: 'Deckow-Crist',
				catchPhrase: 'Proactive didactic contingency',
				bs: 'synergize scalable supply-chains'
			}
		},
		{
			id: 3,
			name: 'Clementine Bauch',
			username: 'Samantha',
			email: 'Nathan@yesenia.net',
			address: {
				street: 'Douglas Extension',
				suite: 'Suite 847',
				city: 'McKenziehaven',
				zipcode: '59590-4157',
				geo: {
					lat: '-68.6102',
					lng: '-47.0653'
				}
			},
			phone: '1-463-123-4447',
			website: 'ramiro.info',
			company: {
				name: 'Romaguera-Jacobson',
				catchPhrase: 'Face to face bifurcated interface',
				bs: 'e-enable strategic applications'
			}
		},
		{
			id: 4,
			name: 'Patricia Lebsack',
			username: 'Karianne',
			email: 'Julianne.OConner@kory.org',
			address: {
				street: 'Hoeger Mall',
				suite: 'Apt. 692',
				city: 'South Elvis',
				zipcode: '53919-4257',
				geo: {
					lat: '29.4572',
					lng: '-164.2990'
				}
			},
			phone: '493-170-9623 x156',
			website: 'kale.biz',
			company: {
				name: 'Robel-Corkery',
				catchPhrase: 'Multi-tiered zero tolerance productivity',
				bs: 'transition cutting-edge web services'
			}
		},
		{
			id: 5,
			name: 'Chelsey Dietrich',
			username: 'Kamren',
			email: 'Lucio_Hettinger@annie.ca',
			address: {
				street: 'Skiles Walks',
				suite: 'Suite 351',
				city: 'Roscoeview',
				zipcode: '33263',
				geo: {
					lat: '-31.8129',
					lng: '62.5342'
				}
			},
			phone: '(254)954-1289',
			website: 'demarco.info',
			company: {
				name: 'Keebler LLC',
				catchPhrase: 'User-centric fault-tolerant solution',
				bs: 'revolutionize end-to-end systems'
			}
		}
	])
	await nds.set('name', 'john doe')
	await nds.set('days', ['senin', 'selasa', 'rabu', 'kamis'])
})()

/**
 * @description get data
 */
;(async () => {
	const getUser = await nds.get('user')
	console.log(getUser)

	const getName = await nds.get('name')
	console.log(getName)

	const getDays = await nds.get('days')
	console.log(getDays)

	console.log((await nds.keys()).length)

	console.log(await nds.clear())
})()

nodejs cache data

    npm install node-cache --save
Source: www.npmjs.com

node cache

node-disk-storage a simple fast and secure local storage for nodejs, 
you can store any data using key and value, and then your data will be 
encrypt to be like this �+�)data|ZGF0YXxqb2huK2RvZV5eXiQwfDFd^^^$0|1

npm i node-disk-storage -S || yarn add node-disk-storage -S

Javascript相关代码片段

lazygit nvim

ex:javascript loop

js slice last element

Multiply a number with .17 and round up to .25

sweetalert 2

booking calendar js

process.env is kept

AnimationEvent has no function name specified!

jquery date picker wordpress enque

js check in view

settimeout event in input in javascript in react

node option size

docker react app

React Modal using Dialog

how to create dynamic object in javascript

how to create global variable in postman

javascript interview questions tricky

how to create workflow request in postman

mysql json_extract array

parse response body in postman

query param generator js

jest function async API

React portal

i18next suppoeort react

puppeteer page evaluate

react router dom use navigate

react create array from another array

how to delete global variable in scripts postman

Where does closure variables stored in javascript

Where does local variables stored in javascript

nodejs là gì

addEventListener for multiple selector

js calculate opacity

nodejs create stripe payment from server easy

get child form value in parent viewchild

javascript capitalize every word in a sentence

how to use jquery in moodle

how to handle no internet error in react query

window in not defined in nextjs

cypress find element inside element

app tracking transparency react native permissions

C# Blazor list to json

puppeteer .cache folder not found

css in js

bootstrap next js

creat element js

angular can't bind to ngmodel

sandy liang

Toast Message always appears behind the modal

selenium and javascript

react native textinput should not autofill

form.getfieldvalue does not change antd

javascript zoom to bumber

javascript reduce exercises

array in js mdn

javascript built in priority queue

prevent parent click events from firing

what is intrinsic function in javascript

next js with pnpm

shopify emacs

dynamic scroll longitude antd table

tree vue js

eslint no-undef console

Count documents by field mongo

vertical column checkbox.group antd

dynamically adding class to anGULAR ELEMENT

random integer between 5 and 10 javascript

javascript refresh image src

url change tag javascript

change style using getelementsbyclassname

js uppercase türkçe

javascript sorting array using for loops

next js router not mounted

show image progress download in js

`NextRouter` was not mounted

Custom Dialog for GSheet

for each js on string

calculator in js

jsonserver

sweetalerts radio alert