Caching by standard
As our applications have scaled up and beyond, caching has become more commonplace in various technologies. As we have seen from our earlier examples, there are lots of different ways and libraries to help us cache data within our application. However, most of these libraries use their own self-defined interfaces, so what if we want to move between technologies? As we have seen earlier, JPA provides a standardized way to persistently store data, with a number of technologies providing compliant implementations, so what if there was an equivalent for relatively short-term cache data?
Well, now, there is, in the form of the long awaited standard, JCache.
In order to use it, first, we will need to add the JCache API library to our classpath; if we are using a dependency manager such as Maven, this should be pretty trivial.
<dependency> <groupId>javax.cache</groupId> <artifactId>cache-api</artifactId> <version>1.0.0</version> ...