• Post Reply Bookmark Topic Watch Topic
  • New Topic

desin issue  RSS feed

 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We had a database table for maintianing system parameters for our application, user needs that information everytime through out the session. can anybody suggest a nice way to keep that data thru out session without getting it from database everytime and not keeping the whole list in session.
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about CachedRowset or making an xml file from database records when user logs in and removing it when log off???
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want it closer to you than the database you probably want it in memory. What's wrong with the Session for that? I can make up some reasons it might be bad, but I'm interested in your reasons.

Another choice might be some kind of global cache, but "global" usually is A Very Bad Thing so let's not go there.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vijaya bacina:
Hi,
We had a database table for maintianing system parameters for our application, user needs that information everytime through out the session. can anybody suggest a nice way to keep that data thru out session without getting it from database everytime and not keeping the whole list in session.


Store it in a 3rd medium? If its not on the database and not in session, then its got to be stored locally because thats all you have left. Perhaps a local temporary file?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading again the next day, I might take back the evil global stuff. This is common enough:

From this code we don't know if ConfigurationMgr goes to the database or XML or resource file or whatever every time or keeps data somewhere. It would be ok for Mgr to keep a static Map and say:

Be sure to make an administrative interface so you can clear that cache without stopping and starting the server. Think about ways to keep the cache from growing too large ... delete the least recently used, the least frequently used, the oldest, some other algorithm.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!