Tag Archives: jcache

@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

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!

JCache: first overview


JCache is out since some months and we already have some implementations popping out (Hazelcast implemented the main part, Infinispan passes all TCKs, commons-jcs passes standalone TCKs – CDI implementation in progress, Spring just integrated it etc…).

This article is just here to present the basic API but some more will come with the features which can make it interesting compared to more simple APIs (like a Map).

Continue reading