http urls monitor.

cluster_commands.go 376B

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