Blog cache

This commit is contained in:
Caleb Gardner
2024-09-04 21:22:52 -05:00
parent 05702814c9
commit fcab9458ee
2 changed files with 23 additions and 2 deletions
+6
View File
@@ -2,6 +2,7 @@ package blog
import (
"net/http"
"sync"
"github.com/CalebQ42/bbConvert"
"github.com/CalebQ42/darkstorm-server/internal/backend"
@@ -14,6 +15,9 @@ type BlogApp struct {
authCol *mongo.Collection
portfolioCol *mongo.Collection
conv bbConvert.ComboConverter
cacheMutex *sync.RWMutex
blogCache map[string]Blog
}
func NewBlogApp(db *mongo.Database) *BlogApp {
@@ -22,6 +26,8 @@ func NewBlogApp(db *mongo.Database) *BlogApp {
authCol: db.Collection("author"),
portfolioCol: db.Collection("portfolio"),
conv: bbConvert.NewComboConverter(),
cacheMutex: &sync.RWMutex{},
blogCache: make(map[string]Blog),
}
return out
}