My app will retrieve a countylist from MySql using a datasource bean. Since all pages will potentially use the same recordset every time I could store the countrylist as a List in some global bean, safe in this case. I could manage to refresh the list any time I want… but when things become more complex what is the best strategy for it, the more scalable solution?
Use a in memory database?
A 3rd part cached resultset?
didnt found one, probably because I’m to new to the subject.
ResultSetis tied to the database connection, it’s a fairly ephemeral construct, and not suitable for caching.I recommend using EhCache to cache your results. It’s an in-memory cache mechanism (with options to overflow to disk, and options to distribute across a cluster). It integrates very nicely with Spring (via
EhCacheManagerFactoryBeanandEhCacheFactoryBean).