code: func GetAndCacheGateway(db sqlx.Queryer, p *redis.Pool, gatewayID lorawan.EUI64) (Gateway, error) {
  	gw, err := GetGatewayCache(p, gatewayID)
  	if err == nil {
  		return gw, nil
  	}
  
  	if err != ErrDoesNotExist {
  		log.WithFields(log.Fields{
  			"gateway_id": gatewayID,
  		}).WithError(err).Error("get gateway cache error")
  		// we don't return the error as we can still fall-back onto db retrieval
  	}
  
  	gw, err = GetGateway(db, gatewayID)
  	if err != nil {
  		return gw, errors.Wrap(err, "get gateway error")
  	}
  
  	err = CreateGatewayCache(p, gw)
  	if err != nil {
  		log.WithFields(log.Fields{
  			"gateway_id": gatewayID,
  		}).WithError(err).Error("create gateway cache error")
  	}
  
  	return gw, nil
  }
docs: // GetAndCacheGateway returns a gateway from the cache in case it is available.
  // In case the gateway is not cached, it will be retrieved from the database
  // and then cached.