func New(cfg *Config, logger logger.Logger, registerer prometheus.Registerer) (pluginregistry.StoragePlugin, error) {
	s := &Plugin{
		cfg:          cfg,
		registerer:   registerer,
		Logger:       logger.NewLogger("redisPlugin"),
		announcement: make(chan struct{}, 1),
	}
	s.LogInfo(nil, "start to init redis(addr: %s)", cfg.Addr)
	if err := s.initRedis(); err != nil {
		return nil, err
	}
	return s, nil
}
New is used to init service
package redis
import (
	"context"
	"errors"
	"strings"
	"time"
	"github.com/go-redis/redis/v8"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/spf13/pflag"
	"github.com/bilibili-base/powermock/pkg/pluginregistry"
	"github.com/bilibili-base/powermock/pkg/util"
	"github.com/bilibili-base/powermock/pkg/util/logger"
)
var _ pluginregistry.StoragePlugin = &Plugin{}
type Plugin struct {
	cfg *Config
	client     *redis.Client
	registerer prometheus.Registerer
	logger.Logger
	announcement chan struct{}
}
type Config struct {
	Enable   bool
	Addr     string
	Password string
	DB       int
	Prefix   string
}
func NewConfig() *Config {
	return &Config{
		Enable: false,
		Addr:   "127.0.0.1:6379",
		Prefix: "/powermock/",
	}
}
func (c *Config) IsEnabled() bool {
	return c.Enable
}
func (c *Config) RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet) {
	f.BoolVar(&c.Enable, prefix+"redis.enable", c.Enable, "define whether the component is enabled")
	f.StringVar(&c.Addr, prefix+"redis.addr", c.Addr, "redis address(ip:port format)")
	f.StringVar(&c.Password, prefix+"redis.password", c.Password, "redis password")
	f.IntVar(&c.DB, prefix+"redis.db", c.DB, "redis database to use")
	f.StringVar(&c.Prefix, prefix+"redis.prefix", c.Prefix, "storage prefix")
}
func (c *Config) Validate() error {
	if c.Addr == "" {
		return errors.New("redis address is required")
	}
	return nil
}