Skip to content

Add directory size cachingΒ #23

@SH20RAJ

Description

@SH20RAJ

🎯 Goal

Cache directory sizes to avoid re-scanning and speed up repeated operations.

πŸš€ Features

cleanmac --use-cache        # Use cached sizes
cleanmac --refresh-cache    # Force refresh

πŸ“Š Example

βœ… Using cached size information (scanned 2h ago)
πŸ“Š To refresh cache, use --refresh-cache

Cached data:
β”œβ”€ Last scan: 2025-10-06 12:30:45
β”œβ”€ Directories scanned: 245
β”œβ”€ Total size calculated: 45.2GB
└─ Cache expires: 2025-10-06 18:30:45 (6h from scan)

πŸ”§ Implementation Details

  • Store cache in ~/.cleanmac/cache.json
  • Include timestamps for invalidation
  • Cache directory sizes and file counts
  • Configurable expiry (default 6 hours)
  • Detect if directories changed

βœ… Acceptance Criteria

  • Cache significantly speeds up scans
  • Cache invalidates correctly
  • Stale cache is detected
  • Manual refresh works

πŸ”— Related

Part of Phase 5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions