点燃多个缓存的缓存过期

时间:2019-09-01 04:55:30

标签: ignite

我有10个点火缓存,但是我只想为4个缓存设置过期策略。例如,我用谷歌搜索,但没有运气。我已经准备了代码,但是需要专家的意见。 XML如下,

        <property name="cacheConfiguration">
        <list>
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name">
                <list>
                <value>CACHE_L4_TRIGGER_NOTIFICATION</value>
                <value>CACHE_L2_COTH</value>
                <value>CACHE_L2_CVOC</value>
                <value>CACHE_L3_MSC</value>
                </list>
                </property>
                <property name="expiryPolicyFactory">
                    <bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
                        <constructor-arg>
                            <bean class="javax.cache.expiry.Duration">
                                <constructor-arg value="DAYS"/>
                                <constructor-arg value="3"/>
                            </bean>
                        </constructor-arg>
                    </bean>
                </property>
            </bean>
        </list>
    </property>

1 个答案:

答案 0 :(得分:1)

您没有定义缓存名称列表,而是定义了CacheConfigurations列表:

    <property name="cacheConfiguration">
    <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="name" value="CACHE_L4_TRIGGER_NOTIFICATION"/>
            <property name="expiryPolicyFactory">
                <bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
                    <constructor-arg>
                        <bean class="javax.cache.expiry.Duration">
                            <constructor-arg value="DAYS"/>
                            <constructor-arg value="3"/>
                        </bean>
                    </constructor-arg>
                </bean>
            </property>
        </bean>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="name" value="CACHE_L2_COTH"/>
            <property name="expiryPolicyFactory">
                <bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
                    <constructor-arg>
                        <bean class="javax.cache.expiry.Duration">
                            <constructor-arg value="DAYS"/>
                            <constructor-arg value="1"/>
                        </bean>
                    </constructor-arg>
                </bean>
            </property>
        </bean>

...