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

Method GetTrendCache

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

Source from the content-addressed store, hash-verified

166}
167
168func (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
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))

Callers

nothing calls this directly

Calls 2

formatWhereKeyFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected