Cache the full book counter
This commit is contained in:
parent
0c3385200e
commit
d0670c0b62
2 changed files with 34 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue