本站源代码
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.

23 lines
376B

  1. package redis
  2. import "sync/atomic"
  3. func (c *ClusterClient) DBSize() *IntCmd {
  4. cmd := NewIntCmd("dbsize")
  5. var size int64
  6. err := c.ForEachMaster(func(master *Client) error {
  7. n, err := master.DBSize().Result()
  8. if err != nil {
  9. return err
  10. }
  11. atomic.AddInt64(&size, n)
  12. return nil
  13. })
  14. if err != nil {
  15. cmd.setErr(err)
  16. return cmd
  17. }
  18. cmd.val = size
  19. return cmd
  20. }
上海开阖软件有限公司 沪ICP备12045867号-1