Пример #1
0
func (d *dataAccess) AddSilence(s *models.Silence) error {
	conn := d.Get()
	defer conn.Close()

	if _, err := conn.Do("ZADD", silenceIdx, s.End.UTC().Unix(), s.ID()); err != nil {
		return err
	}
	dat, err := json.Marshal(s)
	if err != nil {
		return err
	}
	_, err = conn.Do("HSET", silenceHash, s.ID(), dat)
	return err
}
Пример #2
0
func (d *dataAccess) AddSilence(s *models.Silence) error {
	defer collect.StartTimer("redis", opentsdb.TagSet{"op": "AddSilence"})()
	conn := d.GetConnection()
	defer conn.Close()

	if _, err := conn.Do("ZADD", silenceIdx, s.End.UTC().Unix(), s.ID()); err != nil {
		return err
	}
	dat, err := json.Marshal(s)
	if err != nil {
		return err
	}
	_, err = conn.Do("HSET", silenceHash, s.ID(), dat)
	return err
}
Пример #3
0
func (n *nopDataAccess) AddSilence(s *models.Silence) error {
	n.silences[s.ID()] = s
	return nil
}