---
title: "Caching Images · Nuxt OG Image · Nuxt SEO"
canonical_url: "https://nuxtseo.com/docs/og-image/v5/guides/cache"
last_updated: "2026-08-16T10:00:27.731Z"
meta:
  description: "Getting to know how the Caching works with Nuxt OG Image."
  "og:description": "Getting to know how the Caching works with Nuxt OG Image."
  "og:title": "Caching Images · Nuxt OG Image · Nuxt SEO"
---

Nuxt SEO on GitHub

You're viewing **OG Image v5** documentation. For the latest, [~~switch to v6~~](https://nuxtseo.com/docs/og-image/getting-started/introduction).

](https://nuxtseo.com/docs/og-image/v5/getting-started/introduction)

](https://nuxtseo.com/docs/og-image/v5/api/define-og-image)

](https://nuxtseo.com/docs/og-image/v5/releases/v5)

Switch to OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)Switch to Nuxt SEO](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)Switch to Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)Switch to Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)Switch to Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)Switch to Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)Switch to SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)Switch to Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)Switch to Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)Switch to AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

**Core Concepts**

# **Caching Images**

In cases where you need to generate images at runtime, Nuxt OG Image provides a caching layer to reduce the load on your server.

This caching layer uses SWR caching is enabled by default with a cache time of 72 hours.

## Cache Storage

Nitro caching by default will use the memory as a cache storage. This means that if you restart your server, the cache will be cleared.

It's recommended to set a persistent cache storage. This can be done using the `**runtimeCacheStorage**` option.

The option takes the same configuration as the Nuxt `**nitro.storage**` option. See the [**~~Nitro Storage Layer~~**](https://nitro.unjs.io/guide/storage) documentation for more details.

For example:

```ts
export default defineNuxtConfig({
  ogImage: {
    // cloudflare kv binding example, set your own config
    runtimeCacheStorage: {
      driver: 'cloudflare-kv-binding',
      binding: 'OG_IMAGE_CACHE'
    }
  }
})
```

## Cache Time

You can change the cache time of an image by providing `**cacheMaxAgeSeconds**` in milliseconds when defining the image.

```ts
defineOgImage({
  cacheMaxAgeSeconds: 30 // 30 seconds
})
```

Alternatively, you can change the default cache time in your nuxt.config.

nuxt.config.ts

```ts
export default defineNuxtConfig({
  ogImage: {
    defaults: {
      cacheMaxAgeSeconds: 60 * 60 * 24 * 7 // 7 days
    }
  }
})
```

## Purging the cache

If you need to purge the cache, you can do so by visiting the OG Image URL appended with a `**?purge**` query param.

For example, to purge the OG Image cache for this page you could visit:

```
https://nuxtseo.com/__og-image__/image/og-image/guides/cache/og.png?purge
```

## Bypassing the cache

While not recommended, if you prefer to opt-out of caching, you can do so by providing a `**0**` second `**cacheMaxAgeSeconds**` or disabling `**runtimeCacheStorage**`.

```vue
<script lang="ts" setup>
defineOgImage({
  cacheMaxAgeSeconds: 0 // disable at an individual image level
})
</script>
```

**Was this page helpful?**

[**Route Rules** Learn how to use route rules to customise your OG Image.](https://nuxtseo.com/docs/og-image/v5/guides/route-rules) [**JPEGs** Learn how to generate JPEG images instead of PNG for Nuxt OG Image.](https://nuxtseo.com/docs/og-image/v5/guides/jpegs)