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.

31 lines
657 B

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