// Validate id via input value
Validate id via input value
// Validate id via input value
func (s *Storage) Validate(id string, value uint64) bool {
	s.mu.Lock()
	defer s.mu.Unlock()
	if exp, ok := s.expire[id]; ok {
		if exp >= time.Now().Unix() && s.values[id] == value {
			delete(s.expire, id)
			delete(s.values, id)
			PrometheusValidTotal.Inc()
			return true
		}
	}
	PrometheusInValidTotal.Inc()
	return false
}
func ( s * Storage ) Validate ( id string , value uint64 ) bool { s . mu . Lock ( ) defer s . mu . Unlock ( ) if exp , ok := s . expire [ id ] ; ok { if exp >= time . Now ( ) . Unix ( ) && s . values [ id ] == value { delete ( s . expire , id ) delete ( s . values , id ) PrometheusValidTotal . Inc ( ) return true } } PrometheusInValidTotal . Inc ( ) return false }
Validate id via input value
Validate id via input value