Make Replit DB 30x-50x Faster on Nodejs with just One Line
require('better-replit-db') in your JS file.
I recently decided to fork the Replit DB client to add a feature which I thought would greatly improve it: a memcache.
The idea is that instead of every read and write being a get/post request to the actual database, everything is done through a dictionary stored in ram. To then make sure data persists, every write also writes to the DB, but asynchronously. This allows for the program to continue on without having to wait for the request to resolve, therefore increasing speed.
Any recommendations for what I should add, let me know!
P.S. I plan on adding the same feature set to forks of other Replit DB libraries.
Every time I start my program, the data goes null.
const db = require("better-replit-db") db.set("key1", 256) console.log(db.list()) // Output: ["key1"]
After restarting and removing the set function:
const db = require("better-replit-db") console.log(db.list()) /// Output: