(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem)
| 166 | } |
| 167 | |
| 168 | func (i *imlMonitorStatisticsCacheService) GetTrendCache(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem) (*MonInvokeCountTrend, error) { |
| 169 | key := fmt.Sprintf("monitor:trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres)) |
| 170 | |
| 171 | bytes, err := i.commonCache.Get(ctx, key) |
| 172 | if err != nil { |
| 173 | log.Errorf("GetTrendCache cache.Get key=%s err=%s", key, err.Error()) |
| 174 | return nil, err |
| 175 | } |
| 176 | |
| 177 | val := new(MonInvokeCountTrend) |
| 178 | |
| 179 | if err = json.Unmarshal(bytes, val); err != nil { |
| 180 | log.Errorf("GetTrendCache json.Unmarshal key=%s bytes=%v err=%s", key, bytes, err.Error()) |
| 181 | return nil, err |
| 182 | } |
| 183 | |
| 184 | return val, nil |
| 185 | } |
| 186 | |
| 187 | func (i *imlMonitorStatisticsCacheService) SetTrendCache(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem, value *MonInvokeCountTrend) error { |
| 188 | key := fmt.Sprintf("monitor:trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres)) |
nothing calls this directly
no test coverage detected