CACHING
Oldie but Goldie
Raluca Breaur
20th of April 2013
“There are only two hard things
in Computer Science:
cache invalidation
and naming things.” Phil Karlton
Stale data strategy
Time to live
Time to idle
Eviction algorithms
LFU – Least Frequently Used
LRU – Least Recently Used
FIFO
…
HIT
CACHE SOURCE
OF
DATA
MISS
CACHE SOURCE
OF
DATA
Cache performance - Statistics
Hits
Misses
Size
Average GetTime
Eviction Count
Common Data Patterns
Locality Hot Set Data
changes
Catalog
(Countries)
Low
Low
Low
Inventory
(Stocks)
High
High
High
Conversation
(Shopping Cart)
High
High
Low
Caches around us
Browser cache
Use cache control headers: max age, no cache
Database
• Persistence Layer – JPA – 2 layers of cache
High computation
Service – Spring 3.1 Cache Abstraction
JCache
Web Service / 3rd party
Multiple clients - Standalone Cache Server
Service – Spring 3.1 Cache Abstraction/JCache
Cache Providers - JCACHE
java.util.Map GUAVA caches