Java Reference
In-Depth Information
With the cache flush configuration behind us, let's move on to setting up the FIFO
cache size property. Setting the size property to 12 allows us to hold a maximum
of 12 results in the cache (see listing 9.12). Once 12 results occupy the cache, the
oldest item is discarded and the newest item is added to the beginning of the
cache. Since the SQL we use will only provide our cache with a new result every
hour or more, our cache should hold up just fine to aging the data appropriately.
The newer results will always occupy the “front” of the cache while the older
results are discarded.
9.7 Summary
iBATIS provides a good selection of persistence layer cache options. Making the
appropriate choice requires that you exercise thought and care. It's important to
remember that iBATIS caching is value based (versus OID ) and intended to han-
dle caching specifically on the persistence layer.
If the default iBATIS cache options do not meet your needs, you can look into
extending iBATIS (chapter 12) to provide a cache that does. The examples in this
chapter can help you get started; experience will be the best guide. Spend time
getting to know the various types of caches and their options. Become familiar
with each type's particular strengths and weaknesses. This knowledge will help
you determine which option will meet your particular needs.
Search WWH ::

Custom Search