(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem)
| 197 | } |
| 198 | |
| 199 | func (i *imlMonitorStatisticsCacheService) GetMessageTrend(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem) (*MonMessageTrend, error) { |
| 200 | key := fmt.Sprintf("monitor:message_trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres)) |
| 201 | |
| 202 | bytes, err := i.commonCache.Get(ctx, key) |
| 203 | if err != nil { |
| 204 | log.Errorf("GetMessageTrend cache.Get key=%s err=%s", key, err.Error()) |
| 205 | return nil, err |
| 206 | } |
| 207 | |
| 208 | val := new(MonMessageTrend) |
| 209 | |
| 210 | if err = json.Unmarshal(bytes, val); err != nil { |
| 211 | log.Errorf("GetMessageTrend json.Unmarshal key=%s bytes=%v err=%s", key, bytes, err.Error()) |
| 212 | return nil, err |
| 213 | } |
| 214 | |
| 215 | return val, nil |
| 216 | } |
| 217 | |
| 218 | func (i *imlMonitorStatisticsCacheService) SetMessageTrend(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem, val *MonMessageTrend) error { |
| 219 | key := fmt.Sprintf("monitor:message_trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres)) |
nothing calls this directly
no test coverage detected