We are developing node.js + express + mongoDB. There are times when I call up the db and organize it like a bulletin board, but it doesn't change that often, so it feels very inefficient to do DB I/O every time the page is loaded. Is there a way to create a DB cache on nodejs server so that it can only be updated when there is a change in the DB?
node.js mongodb
Why don't you use CashDivis like Memcached or Redis?
Create data at logic end, update cache at update
If it's in the cache, if it's not in the cache, we can just put it in the cache and bring it inYo
To write roughly in pseudocode(?),
if create or update // when recording
db.save // save it in the DB
cache.set(post, text) // write to cache
When I bring it up from the main page,
if cache.has(post) // If there is data in the cache,
return cache.get(post) // return existing data
Else //What if there is no data in the cache?
db.get // get it out of the D.B
Cache.set(post, text) // Save to Cache
return post // save and return
I think it's like this
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
581 PHP ssh2_scp_send fails to send files as intended
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.