I have an application that receives messages from devices every few minutes. I also have clients that request the last 10 messages for a specific device.
I am suffering from some database saturation and I want to cache this list using a device. The basic premise is that when a message is received from a device, the processor that receives the messages will strip the cache for that device.
My question is whether I should just invalidate the cache and then rebuild it when the next client is connecting, or should I have the device processor rebuild the cache to proactive. The device processor can retrieve the current cache, output the last entry, add a new entry, and cache a new result.
I appreciate that this may depend on this, answer, but I would appreciate it if people had experience in this area.
source share