역할


1. 구조

@Component
public class ImageUploadCleanupScheduler {

    private final Path root;      // 업로드 루트 디렉토리
    private final long ttlHours;  // 파일 보존 시간(시 단위)

    private static final List<String> MODULES = List.of("tasks");

    public ImageUploadCleanupScheduler(
            @Value("${app.upload-dir}") String uploadDir,
            @Value("${app.upload-tmp-ttl-hours:24}") long ttlHours
    ) {
        this.root = Paths.get(uploadDir).normalize(); 
        this.ttlHours = ttlHours;
    }

    // 10분마다 실행
    @Scheduled(fixedDelayString = "PT10M") 
    public void cleanupOldTmpFiles() { ... }
}

2. 설명

  1. 루트 경로 & 보존 시간
  2. 청소 대상
  3. 동작
  4. 스케줄링

3. 포인트