Should I Cache My Session Data or Not?

0
3
Asked By CuriousCoder42 On

Hey everyone! I'm working on the authentication part of my project, where we're planning to use a rolling session ID for authentication (not going with JWT this time). I'm curious if it's worth it to cache our session ID and user information in Redis. We're expecting around 1-2k users overall, with about 50 daily active users. Would directly reading and writing to Postgres for every request significantly impact user experience and loading times, or will it be fine?

3 Answers

Answered By DevWhisperer On

It's hard to say without more details about your app, but based on my experience, prioritize user experience over optimization early on. Generally, I’d only look into caching if you actually start seeing performance lag—then you'll have some real data to guide your decision.

Answered By TechGuru99 On

I wouldn't worry about caching right now. Just focus on building your project. If you start noticing performance issues later on, you can add caching then. It's usually easier to optimize once you see any problems in action.

Answered By DevSage88 On

Just curious, why opt for session IDs over bearer tokens? Stateless approaches can simplify things a lot! But regarding your question, I wouldn't stress over caching until you hit a snag that really necessitates it.

CuriousCoder42 -

We went with session ID for a couple of reasons: it’s easier to update critical info like user roles without having to renew the token, easier to revoke, and just simpler to implement overall with less complexity for us.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.