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.

22 lines
376 B

  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. }