【问题标题】:Delete all the keys of ehcache删除ehcache的所有key
【发布时间】:2019-03-20 16:29:30
【问题描述】:

我将 Ehcache 与 Apache camel 一起使用。我公开了一个应该从 Ehcache 中删除所有密钥的休息端点。由于某种原因,它在调用其余端点后没有删除密钥。

下面的代码被用来达到同样的效果:

<restConfiguration component="servlet"
            bindingMode="json" />
        <rest path="/clear">
            <get uri="/ehcache">
                <to uri="direct:clear_ehcache" />
            </get>
        </rest>
<route id="clear_ehcache_001">
            <from uri="direct:clear_ehcache" />
            <setHeader headerName="CamelCacheOperation">
                <constant>CamelCacheDeleteAll</constant>
            </setHeader>
            <setHeader headerName="CamelEhcacheAction">
                <constant>REMOVE_ALL</constant>
            </setHeader>
            <to uri="ehcache://mycache" />  
</route>

我已经坚持了一段时间,因为没有产生任何错误。

【问题讨论】:

    标签: rest apache-camel ehcache spring-camel


    【解决方案1】:

    所以它改为使用以下代码:

    <!-- Rest endpoint for clearing ehcache : Start -->
    <restConfiguration component="servlet"
        bindingMode="json" />
    <rest path="/clear">
        <get uri="/ehcache">
            <to uri="direct:clear_ehcache" />
        </get>
    </rest>
    <!-- Rest endpoint for clearing ehcache : End -->
    
    <!-- Route for clearing ehcache : Start -->
    <route id="clear_ehcache_001">
        <from uri="direct:clear_ehcache" />
        <log id="_logging_clear_ehcache"
            message="Clearing Ehcache records.." />
        <setHeader headerName="CamelEhcacheAction"
            id="getCamelEhCacheAction003">
            <constant>CLEAR</constant>
        </setHeader>
        <to id="_to4"
            uri="ehcache://mycache?keyType=java.lang.String&amp;valueType=java.lang.String" />
    
    </route>
    <!-- Route for clearing ehcache : End -->
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-21
      • 1970-01-01
      • 2016-01-13
      • 1970-01-01
      相关资源
      最近更新 更多