MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / RedisFromContext

Function RedisFromContext

server-source-code/internal/context/context.go:57–64  ·  view source on GitHub ↗

RedisFromContext returns the request's Redis client from the context, or nil if not set.

(ctx stdctx.Context)

Source from the content-addressed store, hash-verified

55
56// RedisFromContext returns the request's Redis client from the context, or nil if not set.
57func RedisFromContext(ctx stdctx.Context) *redis.Client {
58 v := ctx.Value(redisContextKey)
59 if v == nil {
60 return nil
61 }
62 rdb, _ := v.(*redis.Client)
63 return rdb
64}
65
66// RedisResolver resolves the Redis client for a request: client from context, or default.
67// Pass to stores so they use the correct Redis client per request.

Callers 1

RDBMethod · 0.85

Calls 1

ValueMethod · 0.45

Tested by

no test coverage detected