summaryrefslogtreecommitdiff
path: root/plugins/redis/plugin.go
blob: 64b6024e7be0db401b4be3d9ca7466008a8505d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package redis

import (
	"github.com/go-redis/redis/v8"
	"github.com/spiral/roadrunner/v2/interfaces/config"
	"github.com/spiral/roadrunner/v2/interfaces/log"
)

const PluginName = "redis"

type Plugin struct {
	// config for RR integration
	cfg *Config
	// redis client
	universalClient *redis.UniversalClient
	clusterClient   *redis.ClusterClient
	client          *redis.Client
	sentinelClient  *redis.SentinelClient
}

func (s *Plugin) GetClient() *redis.Client {
	return s.client
}

func (s *Plugin) GetUniversalClient() *redis.UniversalClient {
	return s.universalClient
}

func (s *Plugin) GetClusterClient() *redis.ClusterClient {
	return s.clusterClient
}

func (s *Plugin) GetSentinelClient() *redis.SentinelClient {
	return s.sentinelClient
}

func (s *Plugin) Init(cfg config.Configurer, log log.Logger) error {
	_ = cfg
	_ = log
	_ = s.cfg
	return nil
}

func (s *Plugin) Serve() chan error {
	errCh := make(chan error, 1)

	return errCh
}

func (s Plugin) Stop() error {
	return nil
}

func (s *Plugin) Name() string {
	return PluginName
}