MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / Get

Method Get

certcache/local.go:35–53  ·  view source on GitHub ↗
(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

33}
34
35func (cc *LocalCertCache) Get(ctx context.Context, key string) ([]byte, error) {
36 resItem, ok := cc.cache.GetValidOrDelete(key)
37 if !ok {
38 v, _, _ := cc.sf.Do(key, func() (any, error) {
39 res, err := cc.next.Get(ctx, key)
40 item := &certCacheValue{
41 ts: time.Now(),
42 res: res,
43 err: err,
44 }
45 if ctx.Err() == nil {
46 cc.cache.Set(key, item)
47 }
48 return item, err
49 })
50 resItem = v.(*certCacheValue)
51 }
52 return resItem.res, resItem.err
53}
54
55func (cc *LocalCertCache) Put(ctx context.Context, key string, data []byte) error {
56 cc.cache.Set(key, &certCacheValue{

Callers

nothing calls this directly

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected