I have a problem in figuring out how to do some caching of reference data. We are developing a clustered app (using WebLogic 6.1 SP5) which requires data to be cached on the server. The data is produced by five DAO classes which retrieve data from the DB and return the reference data as an array. The idea is to then run the SQL queries daily and, if there is a discrepancy with the cache, to overwrite any or all of the five cached arrays with the new data. Oh, we are also going to store a timestamp for each cached array. A stateless session bean is going to be the user (reader) of the cached data. Now, storing the arrays in the DB is possible but ruled out by our tech lead who does not wish to make any changes to the DB at this stage of the project. We've agreed that memory caching would be fine, but how can I do it in a way that does not violate the EJB 2.0 spec? I can't use in my bean non-final static variables, and I can't serialize to file even if I wanted to. I'm not sure whether it's a good idea to cache in a singleton class, as I don't know how you can guarantee that you really do have a singleton in a container. Any ideas gratefully received ...
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
posted 12 years ago
Kyle's recent article in our newsletter might be of interest to you.