|
|
@ -74,3 +74,29 @@ func SIsmember(key string, field string, url ...string) (int64, error) { |
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 集合成员数 |
|
|
|
*/ |
|
|
|
func SCard(key string,url ...string) (int64, error) { |
|
|
|
|
|
|
|
conn, _, err := Conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
req := &SMembersRequest{proto.String(key),nil} |
|
|
|
|
|
|
|
res := &SSetResponse{} |
|
|
|
|
|
|
|
err = conn.SCard(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
} |