DEV Community

Discussion on: Cache Me If You Can

Collapse
 
patricktingen profile image
Patrick Tingen

Caching can give tremendous results, but also tremendous headaches. As you may know, Phil Karlton said:

"There are only two hard things in Computer Science: cache invalidation and naming things."

Which is true. I have created a database exploration tool that relies heavily on caching things like user preferences and database scheme details. But there were times when I really considered ripping all caching out just because of all the strange errors. When not implemented right, you can get errors that are hard to reproduce. But when done properly..... your program really flies

Collapse
 
krhancoc profile image
Kenneth R Hancock

Yes! I think its very important to really analyze your calls before thinking of a caching solution. In terms of a functional first approach (every input will always get the same output) I think caching is amazing, when you don't have to deal with side effect issues. Its also good to make sure your cache is getting hit a good percentage of the time. If the cache misses 99% of the time, then a cache is probably not going to help.