3 ms·
I read this a lot how people say caching should be a last resort, but it really depends on what you are doing. Many times caching can be the easiest thing to im
by ejs 17y ago
I read this a lot how people say caching should be a last resort, but it really depends on what you are doing. Many times caching can be the easiest thing to implement on certain things.
I have done sites that have a signup page that have a lot of dynamic statistics on that page... I could have spent plenty of time optimizing the calls, but it is far easier to just cache the whole thing, and it will be faster. Clearing the cache is usually not nearly that bad either.
- jcapote 17y agoDefinitely, I think cacheing should be first resort.
- justinchen 17y agoYou just have to be smart about when to apply caching. People can always cite competing caching rules and examples that support them, but only you know your app and whether or not a particular slowness can benefit from more optimizing or more caching.
- jasonkester 17y agoYou're right that caching is the easiest thing. That's why people do it. The problem is that they do it right away, and then eventually the things slows down anyway, and then they're hosed. In the example you describe, the hosing would be relatively minor, since you could hand-optimize the queries and simply plug them back in. In the more common case of caching your 50-query homepage, you might end up needing to buy more servers without ever realizing that you could have gotten it down to one query. So yeah, if you're confident that your signup page is never going to get the sort of load that'll slow it down despite your caching then you're right, you're all set.
- natrius 17y agoYou're not hosed when things slow down. It's easy to disable caching on a development machine and identify the slowdowns.