Get retrieves data from the context. Method returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)).
(key string)
| 456 | // Get retrieves data from the context. |
| 457 | // Method returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)). |
| 458 | func (c *Context) Get(key string) any { |
| 459 | // Unlock without defer to avoid the deferred-call overhead on this hot path. |
| 460 | c.lock.RLock() |
| 461 | v := c.store[key] |
| 462 | c.lock.RUnlock() |
| 463 | return v |
| 464 | } |
| 465 | |
| 466 | // Set saves data in the context. |
| 467 | func (c *Context) Set(key string, val any) { |
no outgoing calls