-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2184a24
commit 689e921
Showing
4 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { getPaths } from './db'; | ||
|
||
export async function purgeAllCommentCache(env: Env, cache: Cache, baseUrl: string) { | ||
const paths = await getPaths(env); | ||
|
||
await Promise.all( | ||
paths.map((path) => { | ||
purgeCommentCache(env, cache, baseUrl, path); | ||
}), | ||
); | ||
} | ||
|
||
export async function purgeCommentCache(env: Env, cache: Cache, baseUrl: string, path: string) { | ||
await cache.delete(`${baseUrl}/comment${path}`); | ||
} | ||
|
||
export async function putCommentCache(env: Env, cache: Cache, baseUrl: string, path: string, resp: Response): Promise<void> { | ||
await cache.put(`${baseUrl}/comment${path}`, resp); | ||
} | ||
|
||
export async function matchCommentCache(env: Env, cache: Cache, baseUrl: string, path: string): Promise<Response | undefined> { | ||
return await cache.match(`${baseUrl}/comment${path}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters