difference between dynamic cache and static cache in java

14,076

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.

Share:
14,076

Related videos on Youtube

Reachgoals
Author by

Reachgoals

Software Engineer working mostly on System Design, Architecture and Management. Visit my blog: https://www.youtube.com/channel/UCY8JVhRabrcrqDJ9gi9lHNg

Updated on June 04, 2022

Comments

  • Reachgoals
    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
      Oliver Charlesworth over 11 years
      These terms have little to do with Java.
    • fge
      fge over 11 years
      Is this really language dependent?
    • Krease
      Krease over 11 years
      this came up as one of the top google results for this - seems useful enough to get started on understanding
    • Reachgoals
      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.