161.4. 例子
使用自定义缓存容器从默认缓存中检索特定密钥:
from("direct:start") .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) .setHeader(InfinispanConstants.KEY).constant("123") .to("infinispan?cacheContainer=#cacheContainer");
从命名缓存检索特定的密钥:
from("direct:start") .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.PUT) .setHeader(InfinispanConstants.KEY).constant("123") .to("infinispan:myCacheName");
使用 lifespan 取值
from("direct:start") .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) .setHeader(InfinispanConstants.KEY).constant("123") .setHeader(InfinispanConstants.LIFESPAN_TIME).constant(100L) .setHeader(InfinispanConstants.LIFESPAN_TIME_UNIT.constant(TimeUnit.MILLISECONDS.toString()) .to("infinispan:myCacheName");