SlideShare a Scribd company logo
/**
* JCache is here. Say Goodbye to proprietary
* Caching APIs!
*
* @author Jaromir Hamala
* @since 18-03-2014
*/
Who Am I?
● Jaromir Hamala
● Passionate Developer
● Working for Hazelcast
● Open Source Fan
Warning: May Get Extremely Silly!
Why?
L1 cache reference                            0.5 ns
Branch mispredict                             5   ns
L2 cache reference                            7   ns             
Mutex lock/unlock                            25   ns
Main memory reference                       100   ns             
Compress 1K bytes with Zippy              3,000   ns
Send 1K bytes over 1 Gbps network        10,000   ns    0.01 ms
Read 4K randomly from SSD*              150,000   ns    0.15 ms
Read 1 MB sequentially from memory      250,000   ns    0.25 ms
Round trip within same datacenter       500,000   ns    0.5  ms
Read 1 MB sequentially from SSD*      1,000,000   ns    1    ms  
Disk seek                            10,000,000   ns   10    ms   
Read 1 MB sequentially from disk     20,000,000   ns   20    ms  
Send packet CA­>Netherlands­>CA     150,000,000   ns  150    ms
Sources: https://gist.github.com/jboner/2841832 http://commons.wikimedia.org/wiki/File:Roaring_Lion_Travis_Jervey.jpg
Evolutions of Caching
● Roll your own :-( Do. Not. Do. That.
● Use a proprietary API :-/
● Use JCache! :-)
What is JCache
● Standard API for Caching
● Think of “JDBC for caching” (only better:)
● JSR-107
– The longest running JSR ever (?)
● “The best thing since sliced bread”
● Targetted to Java SE 6+
What really is JCache
● Basic Caching - somewhat similar to a j.u.Map
● Events
● Computations
Be Aware: It is just an API!
● Think of JMS (only better:)
● It doesn't say anything about data distribution,
network topology or wire-level protocol!
Existing Implementations
● Coherence
● EHCache
● Hazelcast
● Infinispan
Source: http://www.mtbeer.com/how-beer-tap-handles-are-made/
Quick Start
1. Add JCache API JAR on a classpath
2. Choose your implementation
3. Code!
Source: http://commons.wikimedia.org/wiki/File:Start_Jeremy_Wariner_2007.jpg
Basic Terminology
● Cache
● CacheManager – “provides a means of
establishing, configuring acquiring, closing and
destroying uniquely named Caches.”
– Just think of CacheFactory (for now)
● CacheProvider – manages lifecycle of
CacheManagers CacheProvider
CacheManager CacheManager
Cache1
Cache2
Cache3
Cache4
Cache3
Interesting Features I
● Entry Processors
– Data Transformations
– Computing
Interesting Features II
● Listeners
Cache
Listener1
Event
Cache User Update
Listener2
Event
Listeners
● CacheEntryCreatedListener
– onCreated();
● CacheEntryRemovedListener
– onRemoved();
● CacheEntryUpdatedListener
– onUpdated();
● CacheEntryExpiredListener
– onExpired();
Cache Loaders / Writers
Source: http://commons.wikimedia.org/wiki/File:Stipula_fountain_pen.jpg
CacheLoader
public interface CacheLoader<K, V> {
  V load(K key) throws CacheLoaderException;
  
  Map<K, V> loadAll(Iterable<? extends K> 
keys) throws CacheLoaderException;
}
CacheWriter
public interface CacheWriter<K, V> {
  void write(Cache.Entry<? extends K, ? extends V> 
entry) throws CacheWriterException;
  void writeAll(Collection<Cache.Entry<? extends K, 
? extends V>> entries) throws CacheWriterException;
  void delete(Object key) throws 
CacheWriterException;
  void deleteAll(Collection<?> keys) throws 
CacheWriterException;
}
Other Features
● Annotations
– @CacheResult
– @CachePut
– @CacheRemove
– @CacheRemoveAll
● Expiry Policy
● Statistics
● Store-By-Value vs. Store-By-Reference
Integrations
● Spring Framework
● Java EE 8 (maybe)
● Payara
Source: http://towson.shownbyphotos.com/20060818-towson-univ-0003-800.jpg-large.html
Tips & Tricks
● Isolate Implementation-Specific Stuff
● Be carefull with the default CachingProvider
● EntryProcessors are awesome!
http://en.wikipedia.org/wiki/File:1_bowl_skate_boarding.JPG http://www.mylifeonboard.net/2011/03/04/is-it-dangerous-yeah-danger-is-the-middle-name-of-our-sport/
Missing Bits
● No Async Interface in the spec
– Proprietary extensions
● Eviction
● Query
Further Sources
● https://jcp.org/en/jsr/detail?id=107 - 130 pages
● https://github.com/jsr107
● https://groups.google.com/forum/#!forum/jsr107
Questions?
String viking = 
dictionary.get(“Thank you”);
assert(“tack”, viking);

More Related Content

PDF
JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...
PPTX
Windows 7 installation ppt
PPTX
Installation of windows 7 || how to boot pendrive or cd/dvd
PPTX
Windows XP Professional Installation
PDF
Deployment tales
PDF
Deployment tales
PDF
3 manual installation of open vpn
PPT
Rancher OS - A simplified Linux distribution built from containers, for conta...
JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...
Windows 7 installation ppt
Installation of windows 7 || how to boot pendrive or cd/dvd
Windows XP Professional Installation
Deployment tales
Deployment tales
3 manual installation of open vpn
Rancher OS - A simplified Linux distribution built from containers, for conta...

What's hot (20)

PDF
Vagrant勉強会 チュートリアル編
PDF
PHP Benelux 2017 - Caching The Right Way
PDF
Minio: Associated projects in Go programming.
PDF
Vagrant - Team Development made easy
PDF
using Virtualbox NAT and shared folder
PDF
Appsecforum2014 nov14-bk-cryptool-rump
PDF
Managing a lot of servers
PDF
Lighting fast rails with zeus
PPTX
Creating VM for pfsense
ODP
Let's Encrypt failures
PPTX
How to make a WoW server Warlords of Draenor
PDF
SoftNAS Cloud NAS vs. Basic File Services
PPTX
Minio Cloud Storage
PDF
Hyper-V y Contenedores, una nueva forma de virtualización
PPTX
Swift on raspberry pi
PPTX
Central Iowa Linux Users Group October Meeting: Centos 8
PDF
Reactive streams and why it matters - Andrei Krichevskiy
PDF
Restinio (actual aug 2018)
PDF
Node
PDF
Post Metasploitation
Vagrant勉強会 チュートリアル編
PHP Benelux 2017 - Caching The Right Way
Minio: Associated projects in Go programming.
Vagrant - Team Development made easy
using Virtualbox NAT and shared folder
Appsecforum2014 nov14-bk-cryptool-rump
Managing a lot of servers
Lighting fast rails with zeus
Creating VM for pfsense
Let's Encrypt failures
How to make a WoW server Warlords of Draenor
SoftNAS Cloud NAS vs. Basic File Services
Minio Cloud Storage
Hyper-V y Contenedores, una nueva forma de virtualización
Swift on raspberry pi
Central Iowa Linux Users Group October Meeting: Centos 8
Reactive streams and why it matters - Andrei Krichevskiy
Restinio (actual aug 2018)
Node
Post Metasploitation
Ad

Similar to JCache is here. Say Goodbye to proprietary Caching APIs! (20)

PDF
Using JCache to speed up your apps
PDF
Caching and JCache with Greg Luck 18.02.16
PPTX
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
PDF
PDF
JCache - It's finally here
PDF
JCache (JSR107) - QCon London 2015 & JBCNConf Barcelona 2015
PDF
Gimme Caching - The JCache Way
PDF
JCache - Gimme Caching - JavaLand
PDF
Gimme Caching - The JCache Way
PDF
Caching 101: Caching on the JVM (and beyond)
PDF
Ehcache 3: JSR-107 on steroids at Devoxx Morocco
PPT
How to Stop Worrying and Start Caching in Java
PDF
Ehcache 3 @ BruJUG
PDF
Java In-Process Caching - Performance, Progress and Pittfalls
PDF
Java In-Process Caching - Performance, Progress and Pitfalls
PDF
Caching reboot: javax.cache & Ehcache 3
PDF
JSR107 State of the Union JavaOne 2013
PDF
Ehcache3 — JSR-107 on steroids
PDF
Caching 101: sur la JVM et au delà
PPTX
Jug Lugano - Scale over the limits
Using JCache to speed up your apps
Caching and JCache with Greg Luck 18.02.16
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
JCache - It's finally here
JCache (JSR107) - QCon London 2015 & JBCNConf Barcelona 2015
Gimme Caching - The JCache Way
JCache - Gimme Caching - JavaLand
Gimme Caching - The JCache Way
Caching 101: Caching on the JVM (and beyond)
Ehcache 3: JSR-107 on steroids at Devoxx Morocco
How to Stop Worrying and Start Caching in Java
Ehcache 3 @ BruJUG
Java In-Process Caching - Performance, Progress and Pittfalls
Java In-Process Caching - Performance, Progress and Pitfalls
Caching reboot: javax.cache & Ehcache 3
JSR107 State of the Union JavaOne 2013
Ehcache3 — JSR-107 on steroids
Caching 101: sur la JVM et au delà
Jug Lugano - Scale over the limits
Ad

Recently uploaded (20)

PPTX
CHAPTER 2 - PM Management and IT Context
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
assetexplorer- product-overview - presentation
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
System and Network Administraation Chapter 3
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
System and Network Administration Chapter 2
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Transform Your Business with a Software ERP System
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 2 - PM Management and IT Context
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Reimagine Home Health with the Power of Agentic AI​
Softaken Excel to vCard Converter Software.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Internet Downloader Manager (IDM) Crack 6.42 Build 41
assetexplorer- product-overview - presentation
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
System and Network Administraation Chapter 3
Why Generative AI is the Future of Content, Code & Creativity?
System and Network Administration Chapter 2
Wondershare Filmora 15 Crack With Activation Key [2025
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Design an Analysis of Algorithms II-SECS-1021-03
Transform Your Business with a Software ERP System
Navsoft: AI-Powered Business Solutions & Custom Software Development
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Upgrade and Innovation Strategies for SAP ERP Customers

JCache is here. Say Goodbye to proprietary Caching APIs!