Reachgoals
Reachgoals

Reputation: 2201

difference between dynamic cache and static cache in java

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?

Upvotes: 6

Views: 14483

Answers (1)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136022

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.

Upvotes: 4

Related Questions