MCPcopy Create free account
hub / github.com/github/gh-aw / extractCacheMemoryConfig

Method extractCacheMemoryConfig

pkg/workflow/cache.go:290–325  ·  view source on GitHub ↗

extractCacheMemoryConfig extracts cache-memory configuration from tools section Updated to use ToolsConfig instead of map[string]any

(toolsConfig *ToolsConfig)

Source from the content-addressed store, hash-verified

288// extractCacheMemoryConfig extracts cache-memory configuration from tools section
289// Updated to use ToolsConfig instead of map[string]any
290func (c *Compiler) extractCacheMemoryConfig(toolsConfig *ToolsConfig) (*CacheMemoryConfig, error) {
291 if toolsConfig == nil || toolsConfig.CacheMemory == nil {
292 return nil, nil
293 }
294 cacheLog.Print("Extracting cache-memory configuration from ToolsConfig")
295 config := &CacheMemoryConfig{}
296 cacheMemoryValue := toolsConfig.CacheMemory.Raw
297 if cacheMemoryValue == nil {
298 config.Caches = defaultCacheMemoryEntries()
299 return config, nil
300 }
301 if boolValue, ok := cacheMemoryValue.(bool); ok {
302 if boolValue {
303 config.Caches = defaultCacheMemoryEntries()
304 }
305 return config, nil
306 }
307 if cacheArray, ok := cacheMemoryValue.([]any); ok {
308 entries, err := parseCacheMemoryEntries(cacheArray)
309 if err != nil {
310 return nil, err
311 }
312 config.Caches = entries
313 return config, nil
314 }
315 if configMap, ok := cacheMemoryValue.(map[string]any); ok {
316 entry, err := parseCacheMemoryEntry(configMap, "default")
317 if err != nil {
318 return nil, err
319 }
320 config.Caches = []CacheMemoryEntry{entry}
321 return config, nil
322 }
323
324 return nil, nil
325}
326
327func defaultCacheMemoryEntries() []CacheMemoryEntry {
328 return []CacheMemoryEntry{

Calls 4

parseCacheMemoryEntriesFunction · 0.85
parseCacheMemoryEntryFunction · 0.85
PrintMethod · 0.80