You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package metacache
-
- import (
- "time"
-
- "gitlink.org.cn/cloudream/jcs-pub/client/internal/db"
- )
-
- type MetaCache interface {
- ClearOutdated()
- }
-
- type MetaCacheHost struct {
- db *db.DB
- caches []MetaCache
- }
-
- func NewHost(db *db.DB) *MetaCacheHost {
- return &MetaCacheHost{
- db: db,
- }
- }
-
- func (m *MetaCacheHost) Serve() {
- ticker := time.NewTicker(time.Minute)
- for {
- select {
- case <-ticker.C:
- for _, cache := range m.caches {
- cache.ClearOutdated()
- }
- }
- }
- }
|