code: func (s *Server) getOrReplaceAuthMethodValidator(name string, idx uint64, v authmethod.Validator) authmethod.Validator {
  	s.aclAuthMethodValidatorLock.Lock()
  	defer s.aclAuthMethodValidatorLock.Unlock()
  
  	if s.aclAuthMethodValidators == nil {
  		s.aclAuthMethodValidators = make(map[string]*authMethodValidatorEntry)
  	}
  
  	prev, ok := s.aclAuthMethodValidators[name]
  	if ok {
  		if prev.ModifyIndex >= idx {
  			return prev.Validator
  		}
  	}
  
  	s.logger.Printf("[DEBUG] acl: updating cached auth method validator for %q", name)
  
  	s.aclAuthMethodValidators[name] = &authMethodValidatorEntry{
  		Validator:   v,
  		ModifyIndex: idx,
  	}
  	return v
  }
docs: // getOrReplaceAuthMethodValidator updates the cached validator with the
  // provided one UNLESS it has been updated by another goroutine in which case
  // the updated one is returned.