Pentellcc wrote:
But make always make a connection to database to fetch the data also expensive.
It's not expensive in the same way. Memory is a resource that has an absolute limit, while database calls are only limited by the execution time. Allocating too much memory causes the server to stop, while too many queries only makes it go slower.
Pentellcc wrote:
If I want to keep the data from database, session is the only way that I can use? Is there any other way to keep those data cross page to page?
Application variables, application cache, static variables... all those are shared by all users, though, so you need to separate the stored data using a unique key, and you need to use locking to make it thread safe. --- b { font-weight: normal; }