Created
December 23, 2010 00:17
-
-
Save mick/752353 to your computer and use it in GitHub Desktop.
simple cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if((couchcache["popular-"+page])&&(couchcache["popular-"+page].timesaved > (Date.now() - 60000))){ | |
res.send(couchcache["popular-"+page].docs); | |
}else{ | |
//...get doc... | |
if(page < 10){ | |
couchcache["popular-"+page]={"timesaved":Date.now(),"docs":docs}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment