Some fixes

This commit is contained in:
Caleb Gardner
2024-11-14 11:45:43 -06:00
parent b37fb8a7cf
commit 3670f1b7a9
2 changed files with 11 additions and 8 deletions
+5
View File
@@ -109,6 +109,11 @@ func (b *BlogApp) Blog(ctx context.Context, ID string, useCache bool) (*Blog, er
return &blog, nil
}
func (b *BlogApp) Contains(ctx context.Context, ID string) bool {
res := b.blogCol.FindOne(ctx, bson.M{"_id": ID, "draft": false})
return res.Err() == nil
}
func (b *BlogApp) CleanCache(ID string) {
time.Sleep(5 * time.Minute)
b.cacheMutex.Lock()