简体   繁体   中英

Creating an application instance specific cache for Java/WebLogic Web Services

I'm new to both J2EE and WebLogic. I'd trying to determine the best way to implement a non-distributed cache (one cache per application instance) in a Java Web Services application running on WebLogic 10.3. I need to cache several different POJO's.

There will be multiple WebLogic instances running on each server in a cluster. When reading about ServletContext and InitialContext, I was a bit confused. I believe ServletContext is instance specific, but I can only access it from a Servlet, correct? I will need to access to the cache in separate threads so I'm not sure if this is possible outside of a Servlet.

I was reading a bit about JNDI, but it seems to work at the server or cluster level and not for each WebLogic/application instance.

Can anyone provide me with a suggestion and a code example to initialize, access, and destroy a cache of Java POJO's?

Thanks!

Leon

Here is an example on how to implement a method cache with Spring and EHCache: http://opensource.atlassian.com/confluence/spring/display/DISC/Caching+the+result+of+methods+using+Spring+and+EHCache The cache will be local if configured as in the example.

I am using this method in a web service client library to cache the results of a frequently used service that has nearly no update to its data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM