I am currently developing a Node.js app. It has a mySql database server which I use to store all of the data in the app. However, I find myself storing a lot of data that pertains to the User in session storage. How I have been doing this is by using express-session to store the contents of my User class however these User classes can be quite large. I was thinking about writing a middleware that will save the User class as JSON to either redis or mongodb and store the key to the storage within the session cookie. When I retrieve the JSON from redis or mongodb, I will then parse it and use it to reconstruct my User class.
My question is which method would be the fastest performing and also scalable: storing JSON strings in Redis, or storing a mongo document representation of my User class in MongoDB? Thanks!
EDIT: I am planning to include mongoDB in another part of the app, solving a different issue. Also will the JSON parsing from redis be more time-consuming and memory intensive than parsing from mongo? At what reoccuring user count would server memory sessions become a problem?