Browse Source

update redis library

pull/637/head
Chris Lu 7 years ago
parent
commit
8c64d06b3a
  1. 8
      weed/filer/redis_store/redis_store.go

8
weed/filer/redis_store/redis_store.go

@ -3,7 +3,7 @@ package redis_store
import ( import (
"github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/filer"
redis "gopkg.in/redis.v2"
"github.com/go-redis/redis"
) )
type RedisStore struct { type RedisStore struct {
@ -11,10 +11,10 @@ type RedisStore struct {
} }
func NewRedisStore(hostPort string, password string, database int) *RedisStore { func NewRedisStore(hostPort string, password string, database int) *RedisStore {
client := redis.NewTCPClient(&redis.Options{
client := redis.NewClient(&redis.Options{
Addr: hostPort, Addr: hostPort,
Password: password, Password: password,
DB: int64(database),
DB: database,
}) })
return &RedisStore{Client: client} return &RedisStore{Client: client}
} }
@ -27,7 +27,7 @@ func (s *RedisStore) Get(fullFileName string) (fid string, err error) {
return fid, err return fid, err
} }
func (s *RedisStore) Put(fullFileName string, fid string) (err error) { func (s *RedisStore) Put(fullFileName string, fid string) (err error) {
_, err = s.Client.Set(fullFileName, fid).Result()
_, err = s.Client.Set(fullFileName, fid, 0).Result()
if err == redis.Nil { if err == redis.Nil {
err = nil err = nil
} }

Loading…
Cancel
Save