caching
/ˈkæʃɪŋ/noun
Caching temporarily stores previously retrieved or calculated data so later requests can be handled faster and the original source is accessed less often.
Caching means the online shop does not have to fetch product images again on every page visit.
With caching, a system keeps a copy of data it is likely to need again. This temporary storage is called a cache. A browser might store images and stylesheets, while a server might store calculated results or data from a Glossary · In briefdatabaseA database is a structured collection of data that software can store, retrieve and modify. A database management system controls access to that data.Read more. On a later request, the system reads the copy instead of repeating the same work.
How does caching work?
The system first determines which data is suitable for temporary storage. On the first request, the data is often not yet in the cache. The application retrieves it from the original source and stores a copy. A later request can be answered directly from the cache while that copy remains valid.
A cache can sit in different places, such as a browser, web server or content delivery network. Its location determines which part of the data transfer becomes faster. How long a copy remains valid depends on the configuration and how often the original data changes.
When should the cache be refreshed?
A stored copy can become outdated. Cache entries therefore often have a limited lifetime. After that period, the system retrieves the data again or first checks whether the existing copy is still current.
An application can also invalidate the cache immediately when data changes. This is called cache invalidation. The right approach depends on the information: a versioned JavaScript file can be stored for a long time, while current stock levels need frequent updates. Caching requires a deliberate balance between speed, load on the source and freshness.