package boltcache import ( "fmt" "time" ) type Config struct { path string capacity int //单个桶最多放多少条数据 bucketLimit int //保留的bucket的最大个数 keepDays int //最多保留多少天的数据 cleanDuration time.Duration //清理周期 logPrint func(v ...interface{}) } func NewDefaultConfig() *Config { return &Config{ path: "./push.db", capacity: 50, bucketLimit: 10, keepDays: 1, cleanDuration: 10 * time.Second, logPrint: func(v ...interface{}) { fmt.Println(v...) }, } } func NewConfig(path string, capacity int, bucketLimit int, keepDays int,logPrint func(v ...interface{})) *Config { return &Config{ path: path, capacity: capacity, bucketLimit: bucketLimit, keepDays: keepDays, cleanDuration: time.Second * 10, logPrint: logPrint, } }