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.

32 lines
699 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. )
  20. }
  21. func (store *RedisClusterStore) initialize(addresses []string) (err error) {
  22. store.Client = redis.NewClusterClient(&redis.ClusterOptions{
  23. Addrs: addresses,
  24. })
  25. return
  26. }