Caching a complex application can get hairy very quickly. My question is do developers generally build their caching strategy in WHILE developing the application or is it easier to build the application and then go back and layer a caching strategy on top of it?
One thing I find myself doing (when building caching in at the same time I develop an application) is constantly refactoring pieces of the application which affects the caching mechanisms I’ve just implemented for those parts of the application. Then I have to refactor both the application AND caching mechanisms.
I don’t know if there are specific reasons for or against either strategy. If it’s completely subjective then I apologize!
I’d have thought that any sensible separation of concerns in a design/implementation should allow for the addition of caching at a later date.
That said, for an application that’s likely to require caching in the short to medium term, it would seem wise to implement the necessary caching interfaces/classes, etc. even if they’re simply returning un-cached data in the initial implementation.