pub.cache vs DB calls

Hello All,

I have a requirement.

I have 3 cross reference data values having approximately 200 values.

The interface deals with fetching shipment records and inserting the same in the target system.
Per transaction, we can receive more than 300 shipment records.

For processing each shipment record, we need to fetch the target specific cross reference value from the DB.
So, for 300 shipment records, there would be 300*3=900 DB calls for cross reference.

Hence, I created a Public Cache Manager for the same and created 3 caches under it.
For the first time, data is fetched from DB and stored in cache.
Fur subsequent calls for the same cross reference input, data is fetched from cache thus avoiding external DB call.

Is this a good approach?
Will it cause performance overhead on the IS server as ~300 key-value pairs would be stored in the cache.

Will multiple DB call give better performance than using wM cache?

It is a good approach but make sure to have a terracotta software which will synchronize the cache if you have cluster of IS’s and during the server restarts the startup service should be able to pull the records from db (source of truth) and put all into cache.

In case of any issues with cache, you can design your serivce to fallback to DB.

Hello Mahesh,

Thank you so much for your prompt assistance!

Thanks & Regards,
Khushaboo Shandilya