一、sqlmapconfig.xml
<sqlMapConfig>
<settings useStatementNamespaces="true" cacheModelsEnabled="true"/>
</sqlMapConfig>
二、实体类xml
<cacheModel id="query_cache_menu" readOnly="false" serialize="true" type="OSCACHE">
<flushInterval hours="24" />
<flushOnExecute statement="Menu.getMenuCascadeByCondition" />
<flushOnExecute statement="Menu.getMenuByTypeAndValue" />
<flushOnExecute statement="Menu.checkUrl" />
<flushOnExecute statement="Menu.getMenuInfoByCondition" />
<flushOnExecute statement="Menu.getMenuInfoByLocation" />
<property value="600" name="size" />
</cacheModel>
在需要引用的地方 例<select id="getMenuCascadeByCondition" resultMap="MenuResult" cacheModel="query_cache_menu">