I have an program that collects data from other servers. I don’t have access to these servers so I can’t change anything. The servers can give incorrect data, I can solve the problem but I’m a little bit stuck on “when to do the correction”.
I download the data from the server, the data gets processed and stored on the hard-drive. When the same data is needed an there is no change, then I use the old data. So this is basically caching.
There are 2 places where I could apply the correction.
- When I receive the data from the other servers;
- After I cache the data. So right before I use it.
When I apply the correction on the downloaded data directly, then the server doesn’t need to do much calculations. It’s only corrected once.
When I apply the correction after I took it from the cache or when isn’t cached after I cache the data. Then I need more CPU power. But this gives me the advantage to access the original data at all time. I could fall back when I made a mistake and apply a correct correction.
So the question is, when should I apply the correction? And why should I do it that way.