MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / newMemoryCache

Function newMemoryCache

pkg/cache/memory.go:33–39  ·  view source on GitHub ↗
(cfg *config)

Source from the content-addressed store, hash-verified

31}
32
33func newMemoryCache[T any](cfg *config) *memoryCache[T] {
34 cfg.logger.Infow("msg", "cache: using in-memory LRU backend", "ttl", cfg.ttl, "maxSize", defaultMaxSize)
35 return &memoryCache[T]{
36 lru: expirable.NewLRU[string, T](defaultMaxSize, nil, cfg.ttl),
37 logger: cfg.logger,
38 }
39}
40
41func (m *memoryCache[T]) Get(_ context.Context, key string) (T, bool, error) {
42 val, ok := m.lru.Get(key)

Callers

nothing calls this directly

Calls 1

InfowMethod · 0.65

Tested by

no test coverage detected