/Knowledge/sources/honojs__hono/llms-full/cache-middleware-options-oncachenotavailable-void-promise-false--4ee7b690cd80.md
Cache Middleware: Options > onCacheNotAvailable: (() => void | Promis...
Cache Middleware: Options onCacheNotAvailable: (() = void | Promise ) | false Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https:/...
Cache Middleware: Options > onCacheNotAvailable: (() => void | Promise ) | false
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#oncachenotavailable-void-promise-false
Summary
A callback function or false that controls the behavior when the Cache API is not available in the global scope. By default, a message is logged with console.log. You can provide a custom function to customize the behavior, or set it...
Content
A callback function or false that controls the behavior when the Cache API is not available in the global scope. By default, a message is logged with console.log. You can provide a custom function to customize the behavior, or set it to false to suppress the log entirely.
// Custom logging
app.use(
cache({
cacheName: 'my-app-v1',
onCacheNotAvailable: () => {
console.log('Custom log: Cache API is not available.')
},
})
)
// Suppress logging
app.use(
cache({
cacheName: 'my-app-v1',
onCacheNotAvailable: false,
})
)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#oncachenotavailable-void-promise-false",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Cache Middleware > Options > onCacheNotAvailable: `(() => void | Promise )` | `false`",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 284,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Cache Middleware: Options > onCacheNotAvailable: (() => void | Promise ) | false",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}