(ctx context.Context, md *rcommon.Metadata, selfHealInterval time.Duration)
| 96 | } |
| 97 | |
| 98 | func NewCache(ctx context.Context, md *rcommon.Metadata, selfHealInterval time.Duration) *Cache { |
| 99 | c := &Cache{ |
| 100 | ctx: ctx, |
| 101 | |
| 102 | metadata: md, |
| 103 | |
| 104 | SelfHealInterval: selfHealInterval + time.Duration(rand.Intn(60))*time.Minute, // add random interval to avoid all cache refresh at once |
| 105 | RefreshSignal: make(chan struct{}, 1), |
| 106 | DiffBaseDataSet: diffbase.NewDataSet(md), // 所有资源的主要信息,用于与cloud数据比较差异,根据差异更新资源 |
| 107 | ToolDataSet: tool.NewDataSet(md), // 各类资源的映射关系,用于按需进行数据转换 |
| 108 | } |
| 109 | c.tagrecorderHealers = tagrecorderHealer.NewHealers(md.Platform) |
| 110 | c.StartSelfHealing() |
| 111 | return c |
| 112 | } |
| 113 | |
| 114 | func (c *Cache) GetMetadata() *rcommon.Metadata { |
| 115 | return c.metadata |
no test coverage detected