MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / SetTrendCache

Method SetTrendCache

service/monitor/iml.go:187–197  ·  view source on GitHub ↗
(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem, value *MonInvokeCountTrend)

Source from the content-addressed store, hash-verified

185}
186
187func (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))
189
190 bytes, err := json.Marshal(value)
191 if err != nil {
192 log.Errorf("SetTrendCache json.Marshal key=%s val=%v err=%s", key, value, err.Error())
193 return err
194 }
195
196 return i.commonCache.Set(ctx, key, bytes, 5*time.Minute)
197}
198
199func (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))

Callers

nothing calls this directly

Calls 3

formatWhereKeyFunction · 0.85
MarshalMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected