Skip to content

Commit

Permalink
Merge pull request #321 from maretol/add-cache-purger-log
Browse files Browse the repository at this point in the history
Add cache purger log
  • Loading branch information
maretol authored Feb 16, 2025
2 parents 7d040a6 + 9762726 commit 86b3148
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cms-cache-purger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {
}

const bodyJSON = JSON.parse(body) as WebhookPayload
console.log(bodyJSON)

if (bodyJSON.service !== 'maretol-blog') {
return new Response('OK', { status: 200 })
Expand All @@ -40,15 +41,21 @@ export default {
if (bodyJSON.type === 'new') {
// ブログのメインコンテンツに新規作成があった場合
// contentsのキャッシュを削除する
console.log('start deleteContentsCache')
await deleteContentsCache(env)
} else if (bodyJSON.type === 'edit') {
// ブログのメインコンテンツに編集があった場合
// 対象のIDのコンテンツのキャッシュを削除する
console.log('start deleteContentCache')
console.log('id: ' + bodyJSON.id)
await deleteContentCache(env, bodyJSON.id)
} else if (bodyJSON.type === 'delete') {
// ブログのメインコンテンツに削除があった場合
// contentsのキャッシュと対象のIDのコンテンツのキャッシュを削除する
console.log('start deleteContentsCache')
await deleteContentsCache(env)
console.log('start deleteContentCache')
console.log('id: ' + bodyJSON.id)
await deleteContentCache(env, bodyJSON.id)
}
} else if (bodyJSON.api === 'info') {
Expand Down

0 comments on commit 86b3148

Please sign in to comment.