MCPcopy
hub / github.com/gofiber/fiber / SetJSONWithContext

Method SetJSONWithContext

shared_state.go:124–130  ·  view source on GitHub ↗
(ctx context.Context, key string, v any, ttl time.Duration)

Source from the content-addressed store, hash-verified

122}
123
124func (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
132func (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)

Callers 2

SetJSONMethod · 0.95

Calls 2

ensureStorageMethod · 0.95
setEncodedWithContextMethod · 0.95

Tested by 1