Tag Archives: jcs

@CacheResult: JCache + CDI to the rescue of microservices?


JCache API comes with several built in interceptors for CDI making its usage decoupled from the cache API itself and more user friendly.

Let’s have a look to this API.

CacheResult: the method execution killer

Probable one of the most common use cache is to avoid to pay the cost of a method each time you call it.

Reasons can be as different as:

  • Computation done by the method is expensive
  • The method contacts a remote service and you want to cut off the implied latency
  • The method accesses a rate limited resource
  • ….

In this cache @CacheResult brings a nice and easy to setup solution. Simply decorating the method with @CacheResult you will avoid the actual method invocation after the first call and while it is cached.

Basic usage

Here a sample using a service simulating a slow method:

Continue reading

Advertisements

Apache JCS: LorraineJUG slides


On friday I did with Jean-Louis Monteiro the Lorraine JUG. I presented Apache JCS which is a nice Java Caching solution implementing now JCache specification.

Slides are available here: http://rmannibucau.github.io/2015/LorraineJUG/#/.

And few code samples/examples can be found here (this is a maven project you can open in your IDE): https://github.com/rmannibucau/rmannibucau.github.com/tree/master/2015/LorraineJUG/demo.

Don’t hesitate to get in touch the Apache JCS community if you want more information (use Apache Commons mailing list – user@commons.apache.org – and just specify [JCS] in the subject), we’ll be very happy to help you!