Reputation: 97
when a node js program starts, i will read data from a table and store it in nodejs global memory.Once this is loaded, in the program, when traffic comes, select a row from the loaded table based on some parameters.
Upvotes: 1
Views: 2991
Reputation: 23778
SQL Lite is an in-process database which can write either to a disk file or to memory.
const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database(':memory:');
let db = new sqlite3.Database(':memory:', (err) => {
if (err) {
return console.error(err.message);
}
console.log('Connected to the in-memory SQlite database.');
});
Now you can serialize queries and use it as an in-memory database.
Upvotes: 4