MCPcopy
hub / github.com/grpc/grpc-go / NewTimeoutCache

Function NewTimeoutCache

internal/cache/timeoutCache.go:45–50  ·  view source on GitHub ↗

NewTimeoutCache creates a TimeoutCache with the given timeout.

(timeout time.Duration)

Source from the content-addressed store, hash-verified

43
44// NewTimeoutCache creates a TimeoutCache with the given timeout.
45func NewTimeoutCache(timeout time.Duration) *TimeoutCache {
46 return &TimeoutCache{
47 timeout: timeout,
48 cache: make(map[any]*cacheEntry),
49 }
50}
51
52// Add adds an item to the cache, with the specified callback to be called when
53// the item is removed from the cache upon timeout. If the item is removed from

Callers 6

NewFunction · 0.92
TestCacheExpireMethod · 0.85
TestCacheRemoveMethod · 0.85

Calls

no outgoing calls

Tested by 5

TestCacheExpireMethod · 0.68
TestCacheRemoveMethod · 0.68