Reputation: 26587
Should user specific data be cached at the database level or inside JSF sessions scope ?
Upvotes: 1
Views: 1116
Reputation: 39296
There is no one size fits all answer to that question. In a distributed app, state can be stored client side (cookies, etc...), on the application tier in memory, or in more persistent storage like a database. You also don't have to pick one - you can combine.
Instead, there are considerations for your user state data:
There's other combinations like in memory caches that read and write through to a database and cache data for a certain lifetime. That's an option if the data doesn't absolutely have to be up to date.
Another different approach is RESTful apps.
Don't hold state at all in the services - everything goes back to persistent storage and the resources are cacheable outside the app server (akamai, client etc...). It typically leads to more scalable applications (even if a single operation may not be as fast). At that point, persistent storage options define how you scale.
Upvotes: 2