1
我需要在nodejs中創建簡單函數的幫助,這些函數顯示mongodb中某些表中的所有行。如何將mongodb中的數據保存到node.js緩存中?
第二次運行它的函數從node.js緩存中獲取數據,而不是去mongodb。 財產以後這樣的想法:
getData function(){
if(myCache == undefined){
// code that get data from mongodb (i have it)
// and insert into cache of node.js (TODO)
}
else {
// code that get data from cache node.js (TODO)
}
}