I've been researching the various caching options to limit our roundtrip calls to the database. I've kind of taken a liking to JbossCache as a solution, but was hoping some fine folks might suggest a code-based implementation approach for using the library.
Setup: We are currently refactoring a standard web app built on Spring MVC, Tiles,
JSP. The site is 'skinned' depending on the logged in user (by state of user). Due to the 'location' dependent nature of the application, there are pieces of the application (header information, label values, dropdown list values, default field values for certain fields, etc.) which change depending upon the location of the user. Again, these could all be different between states (i.e. default may be 0.8 for a field in Texas, but 0.5 for the same field in Florida). Some of this will be accomplished via ResourceBundles defined by state (labels), but the architect has requested we cache much of the static reference data (dropdowns, etc). In addition, there are complex rules about some aspects of the UI. For example, if we choose Value A in a listbox, a new set of values is displayed in another radio group field. These are also identified as candidates for caching up-front on application startup.
The goal of the development effort is to make the application accessible outside of a purely 'web app' context. They're building out components to be used as web service endpoints that will mimic the workflow that is only currently supported by the web app. The end result is an application which can have services requested ad-hoc using standard XML input and output. The web app is the current model and will continue to be supported, but they're implementing a SOA-based approach.
Does anyone have some good design strategies for implementing a caching solution (
patterns, abstract vs. interface approach)? This will be in a single JVM, so no replication is needed currently, though a library that could handle that for future use-cases would be nice. I like
JBoss Cache/POJO Cache at this point, due to the hierarchical nature of its cache. I can store the default values of fields as such:
root/texas/defaultvals/field1/value
root/florida/defaultvals/field1/value
...
...
That seems to lend some flexibility w/how the data is stored/retrieved.