caching Java objects

View: New views
3 Messages — Rating Filter:   Alert me  

caching Java objects

by Mitch Claborn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What is the preferred method of caching arbitrary Java objects locally
in a Struts application?  I've been making my actions implement
ApplicationAware and storing objects in that Map.  (I think this comes
from the ServletContext?)  Is that the best way or is there something else?

Mitch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: caching Java objects

by Oscar Alvarez-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi...

It depends on what the objects mean on your system... exist
ApplicationAware, SessionAware and RequestAware interfaces...

You decide what to use in your design.

HTH

2009/7/8 Mitch Claborn <mitch@...>

> What is the preferred method of caching arbitrary Java objects locally
> in a Struts application?  I've been making my actions implement
> ApplicationAware and storing objects in that Map.  (I think this comes
> from the ServletContext?)  Is that the best way or is there something else?
>
> Mitch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>


--
Atentamente
Óscar Álvarez Vielma
(09) 8416 4052

Re: caching Java objects

by dusty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For stuff like data dictionary lists, or other random stuff I don't need to reload I will initialize on startup and store in the servletContext.  I will use EhCache for handling cache of model objects when I have a lot of reads and want to improve performance when there are lots of "things".  

I think it depends on the scope of your need, but my guess is that you are thinking about application-wide scope, so you are on the right track.  


Disclaimer: I have an irrational fear and allergic reaction to the HTTP Session map, so I will do probably crazy things to avoid it.  


Mitch Claborn wrote:
What is the preferred method of caching arbitrary Java objects locally
in a Struts application?  I've been making my actions implement
ApplicationAware and storing objects in that Map.  (I think this comes
from the ServletContext?)  Is that the best way or is there something else?

Mitch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org