There seem to be quite a few promising packages with no clear suggestions on which is the fastest,scalable and which is more memory efficient.
- npm install memoizee
- npm install memcached
- lru-cache
- npm install memory-cache
- npm install node-cache
Any reliable sources of information/personal experience with these would help.
So the basic usage is for simple key:value store.
Just need to know if the underlying architecture of these different stores is similar/different and if different then which would be scalable.
[Also which of these is used by express-session to implement the MemoryStore.]
"Which one is better" depends on your requirements such as traffic volume, how much you want to store in-memory cache etc.
When you select an in-memory store, keep in mind node.js is single-threaded and for-loops are blocking codes. If you look at the source for most of these packages such as node-cache, they all have for-loops, iterating through all your cached items for TTL check. So if you store 10000 objects, your app is going to be blocked until 10k iteration is completed. So beware of your choice.
The dependencies for express-session are right on Github in its package.json. I don't see any of your listed storage mechanisms.
Then, if you look at the code for the
MemoryStore
object here, you can see that it's just using a Javascript object to store a list of sessions indexed bysessionId
.