MCPcopy
hub / github.com/SpecterOps/BloodHound / NewCache

Function NewCache

packages/go/cache/cache.go:128–134  ·  view source on GitHub ↗

NewCache takes a cache config. Returns a new Cache instance and an error if the underlying cache returns an error during configuration.

(config Config)

Source from the content-addressed store, hash-verified

126// NewCache takes a cache config. Returns a new Cache instance and an error if the underlying
127// cache returns an error during configuration.
128func NewCache(config Config) (Cache, error) {
129 if cache, err := lru.New(config.MaxSize); err != nil {
130 return Cache{}, fmt.Errorf("error creating cache: %w", err)
131 } else {
132 return Cache{lru: cache}, nil
133 }
134}

Callers 13

setupLRUCacheFunction · 0.92
getPopulatedInstanceFunction · 0.92
TestCache_NewCacheFunction · 0.92
TestCache_SetFunction · 0.92
TestCache_GuardedSetFunction · 0.92
TestCache_FillFifoFunction · 0.92
Test_cacheQueryResultFunction · 0.92
TestGetEntityResultsFunction · 0.92

Calls 2

ErrorfMethod · 0.80
NewMethod · 0.65

Tested by 12

setupLRUCacheFunction · 0.74
getPopulatedInstanceFunction · 0.74
TestCache_NewCacheFunction · 0.74
TestCache_SetFunction · 0.74
TestCache_GuardedSetFunction · 0.74
TestCache_FillFifoFunction · 0.74
Test_cacheQueryResultFunction · 0.74
TestGetEntityResultsFunction · 0.74