Java Reference
In-Depth Information
namespace in the
statement
attribute. The full namespace notation is required
even if the
statement
attribute is referencing a mapped statement within the con-
fines of the same
sqlMap
configuration. When specifying mapped statements that
exist in another
sqlMap
configuration, you must also make sure that the depen-
dent
sqlMap
s have been loaded prior to the
statement
attribute referencing it.
<flushInterval>
The other flush tag used to manage the contents of the cache is
<flushinterval>
.
The
<flushInterval>
tag is a bit simpler than
<flushOnExecute>
since it does not
have any configuration dependencies other than time itself. The
<flushInterval>
tag will flush the cache on a recurring interval. This interval is started at the time
the cache is created during the configuration loading and continues until the
application is shut down. The
<flushInterval>
tag allows you to specify hours,
minutes, seconds, or milliseconds, as shown in table 9.5.
Table 9.5
<flushInterval> tag attributes
Attribute
Represents
The number of hours that should pass before the cache is flushed
hours
(optional)
minutes
(optional)
The number of minutes that should pass before the cache is flushed
The number of seconds that should pass before the cache is flushed
seconds
(optional)
The number of milliseconds that should pass before the cache is flushed
milliseconds
(optional)
To remove any potential confusion,
<flushInterval>
does not allow you to specify
particular times to flush the cache. It is purely interval based. Listing 9.3 shows an
example that uses the
<flushInterval>
tag to limit the lifespan of cached objects
to 12 hours.
Listing 9.3
<flushInterval> caching example
<sqlMap namespace="Category">
…
<cacheModel id="categoryCache" type="MEMORY">
…
<flushInterval hours= "12" />
…
</cacheModel>










