You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
780 B

6 years ago
  1. package redis
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/filer2"
  4. "github.com/chrislusf/seaweedfs/weed/util"
  5. "github.com/go-redis/redis"
  6. )
  7. func init() {
  8. filer2.Stores = append(filer2.Stores, &RedisClusterStore{})
  9. }
  10. type RedisClusterStore struct {
  11. UniversalRedisStore
  12. }
  13. func (store *RedisClusterStore) GetName() string {
  14. return "redis_cluster"
  15. }
  16. func (store *RedisClusterStore) Initialize(configuration util.Configuration) (err error) {
  17. return store.initialize(
  18. configuration.GetStringSlice("addresses"),
  19. configuration.GetString("password"),
  20. )
  21. }
  22. func (store *RedisClusterStore) initialize(addresses []string, password string) (err error) {
  23. store.Client = redis.NewClusterClient(&redis.ClusterOptions{
  24. Addrs: addresses,
  25. Password: password,
  26. })
  27. return
  28. }