MCPcopy Index your code
hub / github.com/daptin/daptin / RemoveAsync

Method RemoveAsync

server/cache/file_cache.go:339–364  ·  view source on GitHub ↗

RemoveAsync removes an entry from cache asynchronously using worker pool

(key string)

Source from the content-addressed store, hash-verified

337
338// RemoveAsync removes an entry from cache asynchronously using worker pool
339func (fc *FileCache) RemoveAsync(key string) {
340 // First check if cache is closed
341 fc.closeMutex.RLock()
342 if fc.closed {
343 fc.closeMutex.RUnlock()
344 return
345 }
346 fc.closeMutex.RUnlock()
347
348 // Try to acquire a worker from the pool
349 select {
350 case <-fc.workerPool:
351 // Got a worker, proceed with async removal
352 go func() {
353 defer func() {
354 // Return worker to pool
355 fc.workerPool <- struct{}{}
356 }()
357 fc.Remove(key)
358 }()
359 default:
360 // Worker pool exhausted, remove synchronously to prevent memory leak
361 log.Debugf("Worker pool exhausted, removing cache entry synchronously: %s", key)
362 fc.Remove(key)
363 }
364}

Callers 2

GetMethod · 0.95
AssetRouteHandlerFunction · 0.80

Calls 1

RemoveMethod · 0.95

Tested by

no test coverage detected