mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
474 B
Go
22 lines
474 B
Go
package op
|
|
|
|
import (
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/zijiren233/gencontainer/synccache"
|
|
)
|
|
|
|
func Init(size int) error {
|
|
roomCache = synccache.NewSyncCache[string, *Room](time.Minute*5, synccache.WithDeletedCallback[string, *Room](func(v *Room) {
|
|
log.WithFields(log.Fields{
|
|
"rid": v.ID,
|
|
"rn": v.Name,
|
|
}).Debugf("room ttl expired, closing")
|
|
v.close()
|
|
}))
|
|
userCache = synccache.NewSyncCache[string, *User](time.Minute * 5)
|
|
|
|
return nil
|
|
}
|