2021-02-20 17:01:39 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
type PersistenceService interface {
|
|
|
|
NewStore(id string, subIDs ...string) Store
|
|
|
|
}
|
|
|
|
|
|
|
|
type Store interface {
|
|
|
|
Load(val interface{}) error
|
|
|
|
Save(val interface{}) error
|
|
|
|
Reset() error
|
|
|
|
}
|
|
|
|
|
|
|
|
type RedisPersistenceConfig struct {
|
2021-05-02 10:16:34 +00:00
|
|
|
Host string `yaml:"host" json:"host" env:"REDIS_HOST"`
|
|
|
|
Port string `yaml:"port" json:"port" env:"REDIS_PORT"`
|
|
|
|
Password string `yaml:"password,omitempty" json:"password,omitempty" env:"REDIS_PASSWORD"`
|
|
|
|
DB int `yaml:"db" json:"db" env:"REDIS_DB"`
|
2021-02-20 17:01:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type JsonPersistenceConfig struct {
|
2021-05-02 10:16:34 +00:00
|
|
|
Directory string `yaml:"directory" json:"directory"`
|
2021-02-20 17:01:39 +00:00
|
|
|
}
|