Setting up JCS as the Cache Provider

The facade for JCS should be an instance of org.wanghy.cache.provider.jcs.JcsFacade.

Properties:

  1. cacheManager (required).

    Should be an instance of org.apache.jcs.engine.control.CompositeCacheManager.

    We can also use the factory org.wanghy.cache.provider.jcs.JcsCacheManagerFactoryBean

    Properties:

    1. configLocation (optional).

      Sets the location of the JCS configuration file.

      The default location is "cache.ccf" in the root of the classpath.

  2. cacheProfiles (required).

    Each cache profile should be an instance of org.wanghy.cache.provider.jcs.JcsCacheProfile

    Properties:

    1. cacheName (required).

      The name of the cache used to store/retrieve an object.

    2. group (optional).

      The group a cache entry belongs to.

For general information about setting up the cache provider please read "Setting up the Cache Provider".

Examples

The cache profiles are defined as a java.util.Map:

<bean id="cacheManager"
    class="org.wanghy.cache.provider.jcs.JcsCacheManagerFactoryBean">
</bean>

<bean id="cacheProvider"
    class="org.wanghy.cache.provider.jcs.JcsFacade">
    <property name="cacheManager">
        <ref local="cacheManager" />
    </property>

    <!-- Cache profiles specified as a java.util.Map -->
    <property name="cacheProfiles">
        <map>
            <entry key="test">
                <bean class="org.wanghy.cache.provider.jcs.JcsCacheProfile">
                    <property name="cacheName">
                        <value>testCache</value>
                    </property>
                    <property name="group">
                        <value>testGroup</value>
                    </property>
                </bean>
            </entry>
        </map>
    </property>
</bean>

The cache profiles are defined as a java.util.Properties:

<bean id="cacheManager"
    class="org.wanghy.cache.provider.jcs.JcsCacheManagerFactoryBean">
</bean>

<bean id="cacheProvider"
    class="org.wanghy.cache.provider.jcs.JcsFacade">
    <property name="cacheManager">
        <ref local="cacheManager" />
    </property>

    <!-- Cache profiles specified as a java.util.Properties -->
    <property name="cacheProfiles">
        <props>
            <prop key="test">[cacheName=testCache][group=testGroup]</prop>
        </props>
    </property>
</bean>