🎨 update memory storage

This commit is contained in:
Fenny
2020-10-31 10:16:11 +01:00
parent 7c012ee154
commit c14befe194
8 changed files with 107 additions and 66 deletions

21
memory/config.go Normal file
View File

@@ -0,0 +1,21 @@
package memory
import "time"
// Config defines the config for memory storage.
type Config struct {
GCInterval time.Duration
}
// ConfigDefault is the default config
var ConfigDefault = Config{
GCInterval: 10 * time.Second,
}
// Helper function to set default values
func configDefault(cfg Config) Config {
if int(cfg.GCInterval) == 0 {
cfg.GCInterval = ConfigDefault.GCInterval
}
return cfg
}