MCPcopy Index your code
hub / github.com/flyteorg/flyte / GetOrCreate

Method GetOrCreate

flytestdlib/utils/auto_refresh_cache.go:115–122  ·  view source on GitHub ↗

Return the item if exists else create it. Create should be invoked only once. recreating the object is not supported.

(item CacheItem)

Source from the content-addressed store, hash-verified

113// Return the item if exists else create it.
114// Create should be invoked only once. recreating the object is not supported.
115func (w *autoRefreshCache) GetOrCreate(item CacheItem) (CacheItem, error) {
116 if val, ok := w.lruMap.Get(item.ID()); ok {
117 return val.(CacheItem), nil
118 }
119
120 w.lruMap.Add(item.ID(), item)
121 return item, nil
122}
123
124// This function is called internally by its own timer. Roughly, it will list keys and for each of the keys, call
125// syncCb, which tells us if the item has been updated. If it has, then do a remove followed by an add. We can get away

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
IDMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected