How does the image caching work?

This is unrelated to other forms of caching. It’s a technical term for the mechanism we implemented but works differently to the forms of caching you are probably using.

In Yoast SEO 7.4 we’ve enhanced our image support. You may have noticed in our changelog, we also added caching for images found in a post to reduce the server load. But you might wonder, how does this actually work?

Well, let’s start at the beginning. This only applies to the og:image tag. If you have the social settings enabled, we want to know what image we need to use for your og:image tag. If you don’t have a featured image and there is no Facebook image set, we’ll use images from your post.

We need to calculate the dimensions of the images found in your post and we’ll need to do some operations for each image we find. We don’t want to do this every time a user of your website loads your post. Therefore, we’ll cache the results of these calculations to the database in the postmeta table where the meta_key is set to _yoast_wpseo_post_image_cache.

This postmeta field will be cleared when you save the post (on the save_post action) because those dimensions will need to be recalculated (you may have removed or added images).

Related articles

Get free SEO tips!