MCPcopy Index your code
hub / github.com/docker/docker-agent / Lookup

Method Lookup

pkg/cache/cache.go:114–121  ·  view source on GitHub ↗

Lookup returns the stored response for the given question and a boolean indicating whether the question was found. When the cache is file-backed and the file has been modified since our last load (typically by another process), the in-memory state is reloaded before the lookup so cross-process writ

(question string)

Source from the content-addressed store, hash-verified

112// our last load (typically by another process), the in-memory state is
113// reloaded before the lookup so cross-process writes are visible.
114func (c *Cache) Lookup(question string) (string, bool) {
115 c.maybeReload()
116 key := c.normalize(question)
117 c.mu.RLock()
118 defer c.mu.RUnlock()
119 resp, ok := c.entries[key]
120 return resp, ok
121}
122
123// Store records the response for the given question, replacing any
124// existing entry with the same normalized key. Storing the same

Calls 1

maybeReloadMethod · 0.95