MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / clear_all

Method clear_all

src/services/file_cache.py:522–543  ·  view source on GitHub ↗

Clear all cached files

(self)

Source from the content-addressed store, hash-verified

520 """
521 Cache base64 encoded image data to local file
522
523 Args:
524 base64_data: Base64 encoded image data (without data:image/... prefix)
525 resolution: Resolution info for filename (e.g., "4K", "2K")
526
527 Returns:
528 Local cache filename
529 """
530 import base64
531 import uuid
532
533 # Generate unique filename
534 unique_id = hashlib.md5(f"{uuid.uuid4()}{time.time()}".encode()).hexdigest()
535 suffix = f"_{resolution}" if resolution else ""
536 filename = f"{unique_id}{suffix}.jpg"
537 file_path = self.cache_dir / filename
538
539 try:
540 # Decode base64 and save to file
541 image_data = base64.b64decode(base64_data)
542 with open(file_path, "wb") as f:
543 f.write(image_data)
544 debug_logger.log_info(
545 f"Base64 image cached: {filename} ({len(image_data)} bytes)"
546 )

Callers

nothing calls this directly

Calls 2

log_infoMethod · 0.80
log_errorMethod · 0.80

Tested by

no test coverage detected