SetProto marshals protocol buffer message represented by pb and stores it under key k in r. Note, that SetProto passes k verbatim to the underlying store and hence, k must represent the full key(including namespace etc.).
(ctx context.Context, r redis.Cmdable, k string, pb proto.Message, expiration time.Duration)
| 247 | // SetProto marshals protocol buffer message represented by pb and stores it under key k in r. |
| 248 | // Note, that SetProto passes k verbatim to the underlying store and hence, k must represent the full key(including namespace etc.). |
| 249 | func SetProto(ctx context.Context, r redis.Cmdable, k string, pb proto.Message, expiration time.Duration) (*redis.StatusCmd, error) { |
| 250 | s, err := MarshalProto(pb) |
| 251 | if err != nil { |
| 252 | return nil, err |
| 253 | } |
| 254 | trace.Logf(ctx, "redis", "set proto to %q", k) |
| 255 | return r.Set(ctx, k, s, expiration), nil |
| 256 | } |
| 257 | |
| 258 | // FindProto finds the protocol buffer stored under the key stored under k. |
| 259 | // The external key is constructed using keyCmd. |
nothing calls this directly
no test coverage detected