MCPcopy Create free account
hub / github.com/Chatterino/api / GetOnly

Method GetOnly

pkg/cache/memory.go:124–140  ·  view source on GitHub ↗
(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

122}
123
124func (c *MemoryCache) GetOnly(ctx context.Context, key string) *Response {
125 log := logger.FromContext(ctx)
126 cacheKey := c.keyProvider.CacheKey(ctx, key)
127
128 if value, _ := kvCache.Get(cacheKey); value != nil {
129 log.Debugw("Memory GetOnly cache hit", "cacheKey", cacheKey)
130 if response, ok := value.(Response); ok {
131 return &response
132 }
133
134 log.Debugw("Memory GetOnly cache type mismatch", "cacheKey", cacheKey)
135 return nil
136 }
137
138 log.Debugw("Memory GetOnly cache miss", "cacheKey", cacheKey)
139 return nil
140}
141
142func NewMemoryCache(cfg config.APIConfig, keyProvider KeyProvider, loader Loader, cacheDuration time.Duration) *MemoryCache {
143 return &MemoryCache{

Callers

nothing calls this directly

Calls 4

FromContextFunction · 0.92
CacheKeyMethod · 0.65
GetMethod · 0.65
DebugwMethod · 0.65

Tested by

no test coverage detected