0

in my java Spring application, I need to build an in-process / in-memory cache of some configuration metadata, which is structured like this:

Graph<String customerName, Map<String, JSONObject> customerMetadata>:

  "My Customer" "CustomerInfo":
                    {IngestionConfig:  {"data": "schema":{"fields"[]}}}
                "Asset"
                    {IngestionConfig:  {"data": "schema":{"fields"[]}}}
                "Invoice"
                    {IngestionConfig:  {"data": "schema":{"fields"[]}}}

Question:

What technique is better suited for this purpose: a Map, a ValueGraph from Google Guava, EhCache, or some other?

Eugene Goldberg
  • 14,286
  • 20
  • 94
  • 167

1 Answers1

1

It depends. Do you want your cache to be expiring after certain time by itself? will you ever need your map to be distributed? Is it read-only or are you planning to update it run-time? If its not read only, is your environment single threaded or multi? If you don't need any of those bells and whistles and if its READ-only, I would rather go with Map (or whatever packed with Java). (This is just an opinion -- I am a minimalistic person.)

so-random-dude
  • 15,277
  • 10
  • 68
  • 113