补遗:CacheFactory

使用什么样的缓存,以及使用什么缓存策略是在配置文件中配置的:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    
<class name="com.fankai.Cat" table="cat">
        
<jcs-cache usage="read-only"/>
        
<id name="id" unsaved-value="null">
            
<generator class="uuid.hex"/>
        
</id>
        
<property name="name" length="16" not-null="true"/>
        
<property name="sex" length="1" not-null="true"/>
        
<property name="weight" />
    
</class>
</hibernate-mapping>



上面指出,对cat表使用read-only策略的JCS缓存。

在CacheFactory中,根据从配置文件中读出的element创建缓存:

public static CacheConcurrencyStrategy createCache(Element node, String name, boolean mutable)


不过,在CacheFactory只是指定了使用什么策略,而具体使用什么缓存机制则是在client指定的。

posted on 2005-01-31 09:59  Na57  阅读(772)  评论(0编辑  收藏  举报