Rework cache middleware to use in-memory cache, remove ExpiringCache module

This commit is contained in:
Alex Gleason
2024-04-13 14:00:21 -05:00
parent a738ed3d4d
commit 6ab3a640bf
4 changed files with 21 additions and 103 deletions

View File

@@ -1,18 +0,0 @@
import { assert } from '@/deps-test.ts';
import ExpiringCache from './expiring-cache.ts';
Deno.test('ExpiringCache', async () => {
const cache = new ExpiringCache(await caches.open('test'));
await cache.putExpiring('http://mostr.local/1', new Response('hello world'), 300);
await cache.putExpiring('http://mostr.local/2', new Response('hello world'), -1);
// const resp1 = await cache.match('http://mostr.local/1');
const resp2 = await cache.match('http://mostr.local/2');
// assert(resp1!.headers.get('Expires'));
assert(!resp2);
// await resp1!.text();
});