DEV Community


Discussion on: What are the core concepts that a new developer needs to know?

tominekan profile image
Tomi Adenekan Author

What is caching?

kallmanation profile image
Nathan Kallman

The storing of information in an easier to access location and/or format that came from a source of data in a more difficult to access location and/or format.

Some examples:

  • Browsers caching CSS/JS/Images because its easier to access from a local hard drive than a request across a network.
  • CPUs caching blocks of memory because its easier to access from on the same chip than to go over the motherboard to the main RAM.
  • caching the count of reactions because its easier to query one column on a record already queried for than to query a whole set of related records and count up the total.

Whenever there is heavy computation or long latency involved in fetching a value, some form of caching may be helpful. The pitfalls being when the source of information changes the cache needs to change as well; and caching too much can ironically slow the system down, since the cache now has higher latency to search/fetch data than getting it from the source.

Thread Thread
tominekan profile image
Tomi Adenekan Author

Thanks for explaining