Upsert the scanCache rather than inserting
diff --git a/src/utils/database.ts b/src/utils/database.ts
index a107d06..c5697f3 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -606,9 +606,10 @@
     }
 
     async write(hash: string, type: "nsfw" | "malware" | "bad_link", data: boolean, tags?: string[]) {
-        await this.scanCache.insertOne(
+        await this.scanCache.updateOne(
+            { hash: hash },
             { hash: hash, [type]: data, tags: tags ?? [], addedAt: new Date() },
-            collectionOptions
+            Object.assign({ upsert: true }, collectionOptions)
         );
     }