Files
zCode-CLI-X/~/.npm-cache/undici@7.24.7@@@1/docs/docs/api/CacheStorage.md
admin 875c7f9b91 feat: Complete zCode CLI X with Telegram bot integration
- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
2026-05-05 09:01:26 +00:00

1.1 KiB

CacheStorage

Undici exposes a W3C spec-compliant implementation of CacheStorage and Cache.

Opening a Cache

Undici exports a top-level CacheStorage instance. You can open a new Cache, or duplicate a Cache with an existing name, by using CacheStorage.prototype.open. If you open a Cache with the same name as an already-existing Cache, its list of cached Responses will be shared between both instances.

import { caches } from 'undici'

const cache_1 = await caches.open('v1')
const cache_2 = await caches.open('v1')

// Although .open() creates a new instance,
assert(cache_1 !== cache_2)
// The same Response is matched in both.
assert.deepStrictEqual(await cache_1.match('/req'), await cache_2.match('/req'))

Deleting a Cache

If a Cache is deleted, the cached Responses/Requests can still be used.

const response = await cache_1.match('/req')
await caches.delete('v1')

await response.text() // the Response's body