Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between dynamic cache and static cache in java

Tags:

java

caching

web

We were looking to develop a cache mechanism and came across terms like dynamic cache and static cache. What is dynamic cache and static cache? Can any one help me to understand with example with respect to java?

like image 314
Reachgoals Avatar asked Jan 05 '13 03:01

Reachgoals


Video Answer


1 Answers

To put it short, static cache is readonly cache and dynamic cache is read and write. Usage examples

Static: on program startup we load some reference data from DB table into a cache once. Now our cache returns data by key instead of making requests to DB.

Dynamic: we have Staff DAO with a cache. On getStaffById we first look in the cache and if it's there return; otherwise read it from DB put it in cache and return. On remove/update we remove/update both in cache and DB.

like image 117
Evgeniy Dorofeev Avatar answered Sep 20 '22 07:09

Evgeniy Dorofeev