coherence-community / oracle-bedrock

Oracle Bedrock
Other
55 stars 31 forks source link

Introduce the ability to cache results of RemoteCallables using a RemoteChannel #383

Closed brianoliver closed 7 years ago

brianoliver commented 7 years ago

As a developer, applications I develop may make multiple requests against same RemoteCallable using the same parameter(s) many times. In such circumstances, and where an appropriate for an application, it would be beneficial if the results of the RemoteCallable could be cached locally to improve performance.

To support this capability we could introduce the concept of a Caching option for a RemoteChannel, including:

  1. Caching.enabled(Option... options) - indicating the result must be cached for the RemoteCallable.

With Options for specifying the duration of the caching and the "identity" of the context in which to perform the caching.

Multiple requests to invoke the same RemoteCallable when Caching is enabled will return the cached result (if still valid)

Result r = application.invoke(callable, Caching.enabled());
  1. Caching.disabled() - indicating any previous result should be ignored (the default)

Importantly, for the results of RemoteCallables to be cached, RemoteCallables must correctly implement hashcode and equals.

brianoliver commented 7 years ago

Introduced as an experimental option.