(ctx context.Context, key string, v any, ttl time.Duration)
| 122 | } |
| 123 | |
| 124 | func (s *SharedState) SetJSONWithContext(ctx context.Context, key string, v any, ttl time.Duration) error { |
| 125 | if err := s.ensureStorage(); err != nil { |
| 126 | return err |
| 127 | } |
| 128 | |
| 129 | return s.setEncodedWithContext(ctx, key, v, ttl, s.jsonEncoder, "json") |
| 130 | } |
| 131 | |
| 132 | func (s *SharedState) GetJSON(key string, out any) ([]byte, bool, error) { //nolint:gocritic // Keep unnamed returns for clarity. |
| 133 | return s.GetJSONWithContext(context.Background(), key, out) |