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.

36 lines
784 B

7 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 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, &RedisStore{})
  9. }
  10. type RedisStore struct {
  11. UniversalRedisStore
  12. }
  13. func (store *RedisStore) GetName() string {
  14. return "redis"
  15. }
  16. func (store *RedisStore) Initialize(configuration util.Configuration) (err error) {
  17. return store.initialize(
  18. configuration.GetString("address"),
  19. configuration.GetString("password"),
  20. configuration.GetInt("database"),
  21. )
  22. }
  23. func (store *RedisStore) initialize(hostPort string, password string, database int) (err error) {
  24. store.Client = redis.NewClient(&redis.Options{
  25. Addr: hostPort,
  26. Password: password,
  27. DB: database,
  28. })
  29. return
  30. }