You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2014/08/23 09:07:11 UTC
[jira] [Resolved] (CAMEL-6509) add a cache get() or getOrUpdate()
pattern to Camel?
[ https://issues.apache.org/jira/browse/CAMEL-6509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-6509.
--------------------------------
Resolution: Won't Fix
> add a cache get() or getOrUpdate() pattern to Camel?
> ----------------------------------------------------
>
> Key: CAMEL-6509
> URL: https://issues.apache.org/jira/browse/CAMEL-6509
> Project: Camel
> Issue Type: New Feature
> Reporter: james strachan
>
> See the example 7 on the cache page:
> http://camel.apache.org/cache.html
> it'd be nice if we could easily add a 'lookup in the cache for a given key expression, use it as the payload if its found, otherwise invoke some remote endpoint, update the cache and return that new value'; so folks can easily add caching in front of endpoints.
> I'm wondering if this might be more intuitive if its an actual pattern? e.g.
> {code}
> from("seda:foo").
> cache("myCacheName").xpath("/foo/customerId").
> getOrUpdate("http://the.remote.thingy").
> // now carry on doing normal camel stuff...
> {code}
> We can then use expressions for the key to use (and possibly for the cache name - or a constant string can be defaulted), then the operations are either get() or getOrUpdate() - the latter taking an Endoint or URI to invoke if there is no value in the cache.
> e.g. to just do a cache lookup...
> {code}
> from("seda:foo").
> cache("myCacheName").xpath("/foo/customerId").
> get().
> // now carry on doing normal camel stuff...
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)