type RuntimeCache … type podsGetter … // NewRuntimeCache creates a container runtime cache. func NewRuntimeCache(getter podsGetter, cachePeriod time.Duration) (RuntimeCache, error) { … } type runtimeCache … // GetPods returns the cached pods if they are not outdated; otherwise, it // retrieves the latest pods and return them. func (r *runtimeCache) GetPods(ctx context.Context) ([]*Pod, error) { … } func (r *runtimeCache) ForceUpdateIfOlder(ctx context.Context, minExpectedCacheTime time.Time) error { … } func (r *runtimeCache) updateCache(ctx context.Context) error { … } // getPodsWithTimestamp records a timestamp and retrieves pods from the getter. func (r *runtimeCache) getPodsWithTimestamp(ctx context.Context) ([]*Pod, time.Time, error) { … }