当前位置: 首页 > 工具软件 > OJB > 使用案例 >

OJB的缓存管理

易招
2023-12-01

OJB提供缓存接口ObjectCache

在ORM映射中配置如下:

 

<class-descriptor
    class="org.apache.ojb.broker.util.sequence.HighLowSequence"
    table="OJB_HL_SEQ"
>
    <object-cache class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
    </object-cache>
...
</class-descriptor>

 

OJB二级缓存

ObjectCacheTwoLevelImpl

 

ObjectCacheTwoLevelImpl is a two level ObjectCache implementation with a transactional session- and a shared application-cache part.

<object-cache class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl">
    <!-- meaning of attributes, please see docs section "Caching" -->
    <!-- common attributes -->
    <attribute attribute-name="cacheExcludes" attribute-value=""/>

    <!-- ObjectCacheTwoLevelImpl attributes -->
    <attribute attribute-name="applicationCache"
        attribute-value="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl"/>
    <attribute attribute-name="copyStrategy"
        attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStrategyImpl"/>
    <attribute attribute-name="forceProxies" attribute-value="true"/>

    <!-- ObjectCacheDefaultImpl attributes -->
    <attribute attribute-name="timeout" attribute-value="900"/>
    <attribute attribute-name="autoSync" attribute-value="true"/>
    <attribute attribute-name="cachingKeyType" attribute-value="0"/>
    <attribute attribute-name="useSoftReferences" attribute-value="true"/>
</object-cache>
 

 

 

 

 类似资料: