MCPcopy Create free account
hub / github.com/VersusControl/devops-ai-guidelines / New

Function New

02-mcp-for-devops/code/07/pkg/cache/store.go:29–40  ·  view source on GitHub ↗

New constructs a Store with the supplied max size and TTL.

(maxSize int, ttl time.Duration)

Source from the content-addressed store, hash-verified

27
28// New constructs a Store with the supplied max size and TTL.
29func New(maxSize int, ttl time.Duration) *Store {
30 if maxSize <= 0 {
31 maxSize = 1024
32 }
33 return &Store{
34 maxSize: maxSize,
35 ttl: ttl,
36 items: make(map[string]*list.Element, maxSize),
37 lru: list.New(),
38 now: time.Now,
39 }
40}
41
42// Get returns the cached value and true if present and unexpired.
43func (s *Store) Get(key string) (any, bool) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected