Skip to content

Query cache

The Query Cache provides light-weight and transparent in-memory caching of many database queries (such as post lookups) which reduces the overall load on the database and results in a faster, more-scalable site.

All application code that uses the WP_Query API will automatically benefit from this caching layer.

Most write operations will flush this cache (such as post updates and comments) to ensure fresh data. Because of this, it is important to cache expensive queries in a more persistent way, using object caching.

Last updated: December 22, 2023

Relevant to

  • WordPress