Cache the full book counter

This commit is contained in:
Las Zenow 2017-05-19 00:27:14 +00:00
parent 0c3385200e
commit d0670c0b62
2 changed files with 34 additions and 4 deletions

View file

@ -31,8 +31,9 @@ const (
)
type pgDB struct {
sql *pg.DB
tags []string
sql *pg.DB
tags []string
bookCount int
}
// Options for the database
@ -58,8 +59,10 @@ func Init(options Options) (DB, error) {
})
// TODO: create db
db := pgDB{sql, []string{}}
var db pgDB
db.sql = sql
go db.tagUpdater()
go db.countUpdater()
return &db, nil
}