示例#1
0
        /// <summary>
        /// Returns the RedisKpiValues for the given KpiEnums which have the given ShipId,
        /// and whose timestamps are between the given startDate and endDate.
        /// </summary>
        public List <RedisKpiValue> GetRange(long shipId, List <EKpi> kpiEnums, DateTime startDate, DateTime endDate)
        {
            List <string> keys = new List <string>();

            for (var currDate = startDate; currDate < endDate; currDate = currDate.AddDays(1))
            {
                foreach (var kpi in kpiEnums)
                {
                    keys.Add(KpiValueKeyFormatter.GetKey(shipId, kpi, currDate));
                }
            }
            return(RedisDatabaseApi.Search <RedisKpiValue>(keys));
        }
示例#2
0
        /// <summary>
        /// Returns the RedisSensorValuesRows for the ship with the given ShipId,
        /// and whose timestamps are between the given Unix timestamps (in milliseconds since Jan 1, 1970).
        /// </summary>
        public List <RedisSensorValuesRow> GetRange(long shipId, long startMinuteUnixMilliTs, long endMinuteUnixMilliTs)
        {
            List <string> keys = new List <string>();

            for (long currMinuteInUnixMillis = startMinuteUnixMilliTs;
                 currMinuteInUnixMillis < endMinuteUnixMilliTs;
                 currMinuteInUnixMillis += 60000)
            {
                keys.Add(SensorValuesRowKeyFormatter.GetKey(shipId, currMinuteInUnixMillis));
            }

            return(RedisDatabaseApi.Search <RedisSensorValuesRow>(keys));
        }