H
H Branyan
I have a User class that takes a UserID as a parameter in the constructor,
and then looks up the record in the DB and stores the values into the User
class properties. Often when a page loads, I have to grab the same User
several times to display information on several different places on the
page.
In order to minimize the connections to the database when its the same User,
in this instance, I'd like for my User class to store Users as they are
created into some object that is Cached. When the User constructor is
called, it would check this Cache object and then use the Cached data in the
properties, rather than make a call to the database.
I am thinking of using Hashtable, with the UserId as the key, and the User
object for the Userid as the value. But this approach seems rather awkward.
Does anyone have ideas or suggestions? I would appreciate your input.
Thanks
and then looks up the record in the DB and stores the values into the User
class properties. Often when a page loads, I have to grab the same User
several times to display information on several different places on the
page.
In order to minimize the connections to the database when its the same User,
in this instance, I'd like for my User class to store Users as they are
created into some object that is Cached. When the User constructor is
called, it would check this Cache object and then use the Cached data in the
properties, rather than make a call to the database.
I am thinking of using Hashtable, with the UserId as the key, and the User
object for the Userid as the value. But this approach seems rather awkward.
Does anyone have ideas or suggestions? I would appreciate your input.
Thanks