Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

From my general understanding I believe UserContext for a web application is supposed to hold user authentication and authorization (user roles) information.

As part of user roles, there are definitions on who can access what data and accordingly the corresponding reference data is loaded into the UserContext as well.

Is this a good practice to load and use reference data from UserContext? Does this have any impact with the number of sessions vs size of data it is holding inside JVM?

I am thinking we use UserContext only for authentication and authorization but load the reference data from cache on demand and use it if required.

share|improve this question

1 Answer 1

This is always a trade off of how much space you're taking up in the session. How big is your reference data? Generally speaking, unless it's small I'd use the caching approach you described.

DOn't forget that user sessions can be shared across clusters etc as well, so generally speaking keeping them small is a good thing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.