cf-workers-query
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -0,1 +1,13 @@ | ||
## 0.5.2 (2024-09-02) | ||
### 🩹 Fixes | ||
- **cache-api:** detect if cache API is available ([3b6fb22](https://github.com/anymaniax/cf-workers-query/commit/3b6fb22)) | ||
- **tsconfig:** bundle ([2363c63](https://github.com/anymaniax/cf-workers-query/commit/2363c63)) | ||
### ❤️ Thank You | ||
- Victor Bury | ||
## 0.5.1 (2024-09-02) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "cf-workers-query", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Automatically cache and revalidate data in Cloudflare Workers. Using the Cache API and Execution Context", |
export const CACHE_URL = 'INTERNAL_CF_WORKERS_QUERY_CACHE_HOSTNAME.local'; | ||
const getVoidCache = () => { | ||
console.warn('No caches API available'); | ||
return { | ||
open: async (cacheName) => { | ||
return { | ||
put: async (key, value) => { | ||
return; | ||
}, | ||
match: async (key) => { | ||
return null; | ||
}, | ||
delete: async (key) => { | ||
return; | ||
}, | ||
}; | ||
} | ||
}; | ||
}; | ||
const getCache = async (cacheName) => { | ||
if (!globalThis.caches) { | ||
return getVoidCache(); | ||
} | ||
return caches.open(cacheName); | ||
}; | ||
export class CacheApiAdaptor { | ||
@@ -3,0 +27,0 @@ cacheName; |
22244
352