Peek returns the cached CommandInfo map without triggering a Redis round-trip. Returns nil when the cache is cold; callers should fall back to other heuristics. Note: during the very first Get() (initial population) this call will block on the writer lock. After that, concurrent Peek() calls do not
()
| 5249 | // the writer lock. After that, concurrent Peek() calls do not block each other. |
| 5250 | // The returned map and its entries MUST NOT be mutated by the caller. |
| 5251 | func (c *cmdsInfoCache) Peek() map[string]*CommandInfo { |
| 5252 | if c == nil { |
| 5253 | return nil |
| 5254 | } |
| 5255 | c.refreshLock.RLock() |
| 5256 | defer c.refreshLock.RUnlock() |
| 5257 | return c.cmds |
| 5258 | } |
| 5259 | |
| 5260 | // ------------------------------------------------------------------------------ |
| 5261 | const ( |
no outgoing calls