aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/redis/redis_cluster_store.go
blob: 02a62567ce1ed8b30c20216d288b1797430a13c9 (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
package redis

import (
	"github.com/chrislusf/seaweedfs/weed/filer2"
	"github.com/go-redis/redis"
)

func init() {
	filer2.Stores = append(filer2.Stores, &RedisClusterStore{})
}

type RedisClusterStore struct {
	UniversalRedisStore
}

func (store *RedisClusterStore) GetName() string {
	return "redis_cluster"
}

func (store *RedisClusterStore) Initialize(configuration filer2.Configuration) (err error) {
	return store.initialize(
		configuration.GetStringSlice("addresses"),
	)
}

func (store *RedisClusterStore) initialize(addresses []string) (err error) {
	store.Client = redis.NewClusterClient(&redis.ClusterOptions{
		Addrs: addresses,
	})
	return
}