Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ValueListHandler and cahing

 
Steven Dolan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it possible to have a cache that is common to all users? I am trying to implement something similar to forums where you can create a new topic and add replies to an existing one.

Thanks in advance,

Steven
 
Steven Dolan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea how to achive caching for all users?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caches are usually just some kind of collection as a static variable on a class with static methods to get & put stuff. So it's that easy to make something available to all users ... in one JVM.

The cache is a gamble that it's worth using up memory to give faster access to frequently requested data than you'd get from a database or file system or some other source. For something like your application, you'd want the data to also be in a database or file system for long term storage and you should update or clear the cache any time you update those external data stores. Now you're also gambling that the complexity of keeping the cache in sync is worth it.

Finally, if you have multiple JVMs in a cluster you have to keep them all in sync. An in-memory cache might be a very complex thing if your data changes often, or a very simple thing if your data never changes.

Any of that sound like you can use it?
 
Balachandran Paranjothimani
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the Servlet filters. You can implement caching by using them.
 
Steven Dolan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stan and Balachandran,

Any resource you suggest to read more about caching?

I am planning to implement the cache in the middle tire using VLH and DAO so servlet filters are not an option for me.
Take a look at the Servlet filters. You can implement caching by using them.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know any resources better than Google for "java cache" or for more complex fun "java distributed cache". I make sure in my systems to have a management tool to clear caches in a running system. I can change things in the database and clear cache so the app loads the new data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic