19 lines
320 B
Go
19 lines
320 B
Go
|
package storage
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/spf13/viper"
|
||
|
)
|
||
|
|
||
|
type KVHandler interface {
|
||
|
Put(k string, v any) error
|
||
|
PutWithTTL(k string, v any, duration time.Duration) error
|
||
|
Get(k string) (any, error)
|
||
|
Delete(k string) error
|
||
|
}
|
||
|
|
||
|
func NewKVHandler(cfg *viper.Viper) (KVHandler, error) {
|
||
|
return NewEtcdHandler(cfg)
|
||
|
}
|