
Zephyr
Lightweight service worker caching library for web applications
Simple Configuration
Define caching rules with regex patterns. No complex setup required.
Multiple HTTP Methods
Cache GET and POST requests. POST uses intelligent payload hashing.
TTL-based Expiration
Configure cache lifetime per rule with automatic expiration.
LRU Eviction
Automatic cache size management with configurable limits.
Cache Invalidation
Multiple strategies for enterprise CMS integration.
HTTP Header Support
Respects Cache-Control, ETag, and Last-Modified headers.
Quota Monitoring
Track storage usage with configurable limits and warnings.
Configurable Fallback
stale-while-revalidate, stale-if-error, or network-only strategies.
TypeScript Support
Full type definitions included for better developer experience.
Quick Install
npm install @maravilla-labs/zephyr
Or use the CDN:
<script type="module" src="https://unpkg.com/@maravilla-labs/zephyr@0.2.0/lib/zephrInstall.js"></script>
Quick Example
// zephyrConfig.js
importScripts('https://unpkg.com/@maravilla-labs/zephyr@0.2.0/lib/zephyrWorker.js');
const config = {
rules: [
{
test: '.*\\.(png|jpg|jpeg|gif|webp|svg)$',
method: 'GET',
cache: 60,
maxEntries: 100
}
]
};
initZephyr(config);