The OSCACHE cache model uses the OSC ache 2.0 product from OpenSymphony
(www.opensymphony.com/oscache/). OSC ache is a robust caching framework that
is able to perform many of the same type of caching strategies that iBATIS provides
in its other cache models. When using the OSCACHE model, you create a depen-
dency on the OSC ache JAR s. You will need to include the OSC ache JAR in your
project when you use this setting. This cache is configured in the same manner as
a standard OSC ache install. This means that you will need to have an oscache.prop-
erties file available on the root of your classpath for OSC ache to read. For more
information on how to install and configure OSC ache, access the documentation
online at www.opensymphony.com/oscache/documentation.action. Listing 9.7
shows an example of what the OSCACHE cache model may look like.
Sample OSCACHE cacheModel
<cacheModel id="categoryCache" type="OSCACHE">
Your cache model here
Earlier, we mentioned that the cache model was a pluggable component in the
framework. You may be wondering how you create your own cache model, or
maybe you're just curious about how you would do it.
There are only two things to remember. First, the four cache model types that
come with iBATIS are implementations of the com.ibatis.sqlmap.engine.cache.
CacheController interface. Second, the names are type aliases that map to the
fully qualified names of those implementations.
Moving right along, now that you have a cache model, let's look at some ways
to make it work for you.
9.6 Determining a caching strategy
When you're making a determination about caching strategies, you first have to
clarify your requirements. IBATIS provides the previously mentioned set of cach-
ing strategies for the data access layer. These caching strategies can—and likely
will—play into your overall caching strategy, but they probably won't be the sum
Search WWH ::