public static RedisKey GetHour(IDatabase database, string category, string action, DateTime dateTime)
{
// get the key
string hour = BitwiseAnalytics.DateTimeUtil.OneHour(dateTime);
RedisKey key = EventKey(category, action, hour);
// return it if there's already data for this hour
bool hourExists = BitwiseAnalytics.Exists(database, key);
if (hourExists)
{
return key;
}
// no data for the hour, so we need to create it from the 15 minute intervals
string[] fifteenMinutesInHour = BitwiseAnalytics.DateTimeUtil.FifteenMinutesInHour(dateTime);
BitwiseAnalytics.BitwiseOr(
database,
key,
fifteenMinutesInHour.Select(x => EventKey(category, action, x)).ToArray());
return key;
}