You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "james strachan (JIRA)" <ji...@apache.org> on 2013/07/04 11:05:20 UTC

[jira] [Created] (CAMEL-6509) add a cache lookup-or-update type pattern to Camel?

james strachan created CAMEL-6509:
-------------------------------------

             Summary: add a cache lookup-or-update type 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira