difference between dynamic cache and static cache in java
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.
Related videos on Youtube
Reachgoals
Software Engineer working mostly on System Design, Architecture and Management. Visit my blog: https://www.youtube.com/channel/UCY8JVhRabrcrqDJ9gi9lHNg
Updated on June 04, 2022Comments
-
Reachgoals almost 2 years
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?
-
Oliver Charlesworth over 11 yearsThese terms have little to do with Java.
-
fge over 11 yearsIs this really language dependent?
-
Krease over 11 yearsthis came up as one of the top google results for this - seems useful enough to get started on understanding
-
Reachgoals over 11 years@OliCharlesworth, I asked an example with respect to java. I didn't mean static and dynamic cache is related to java or any other language.
-