Moving Forward with the Java Caching API
One of the big topics of conversation at last week’s JavaOne conference in San Francisco was JCache, the Java Temporary Caching API, alternatively known as JSR 107. In fact, all of the JavaOne sessions dedicated to the topic were delivered to a standing room only crowd, as you can see by the adjacent photo taken during Greg Luck and Cameron Purdy’s session on the topic.
“It’s something we always wanted to do. And the community has always wanted us to standardize,” says Greg. But enough progress has now been made that Oracle is confident that the standard will be part of the next Java EE release.
The benefits of standardization
And what is the big benefit to having a standardized caching API? First and foremost, standardization creates a much more egalitarian landscape for proprietary cache users. Currently, moving from one caching implementation to another means changing a fairly significant amount of code. A standardized API makes switching between proprietary implementations much easier. “You can swap the vendor out under the covers without changing any code,” Greg Luck says.
Of course, there’s always a tradeoff between using a ‘one-size fits all’ API and using all of the hooks and special features a given cache implementation might provide. JPA users often hit roadblocks where they yearn for simple access to a basic JDBC connection, or even a special Hibernate or TopLink feature. To address this, the caching API still provides a simple way to tap into any vendor specific features.
Avoiding the standardization straight-jacket
“The way the code is done, there is an unwrap method where you can get at the underlying implementation, so you’re not put in a straight-jacket by the specification. But the spec will cover 98 to 99% of API caching needs.”
The spec isn’t completely finished. “We’re just about done,” says Greg. But the final stages will be completed soon, and enterprise developers can look forward to the caching API to be released as key part of the next version of Java EE.