MCPcopy Create free account
hub / github.com/ShukeBta/MediaStationGo / SetJSON

Method SetJSON

internal/service/runtime_cache.go:100–113  ·  view source on GitHub ↗
(ctx context.Context, key string, value any, ttl time.Duration)

Source from the content-addressed store, hash-verified

98 }
99 return false
100}
101
102func (c *RuntimeCacheService) SetJSON(ctx context.Context, key string, value any, ttl time.Duration) {
103 if !c.Enabled() || strings.TrimSpace(key) == "" || value == nil || ttl <= 0 {
104 return
105 }
106 raw, err := json.Marshal(value)
107 if err != nil {
108 return
109 }
110 fullKey := c.key(key)
111 c.setMemory(fullKey, raw, ttl)
112 if c.client != nil {
113 _ = c.client.Set(ctx, fullKey, raw, ttl).Err()
114 }
115}
116

Callers 9

ListMediaVisibleMethod · 0.80
ComputeMethod · 0.80
LatestItemsMethod · 0.80
mediaItemsMethod · 0.80
applyStatsVisibilityFunction · 0.80

Calls 4

EnabledMethod · 0.95
keyMethod · 0.95
setMemoryMethod · 0.95
SetMethod · 0.45