Skip to content

feat: add smart cache protection for active apps #26

@seunggabi

Description

@seunggabi

Problem

User reported that cache cleanup was deleting login sessions and preferences from actively used applications.

Solution

Implement multi-layer cache protection:

  1. Protect installed apps' caches (from /Applications)
  2. Protect running apps' caches (via lsappinfo)
  3. Protect recently used caches (within MAC_OPS_CACHE_RECENT_DAYS, default: 3 days)
  4. Only clean orphan caches from uninstalled/inactive apps older than MAC_OPS_CACHE_MAX_AGE_DAYS (default: 7 days)

Changes

  • Add MAC_OPS_CACHE_RECENT_DAYS environment variable (default: 3)
  • Collect installed app bundle IDs from /Applications
  • Collect running app bundle IDs via lsappinfo
  • Skip cache cleanup for protected apps
  • Update README with configuration documentation and protection policy

Impact

  • Prevents accidental deletion of login sessions, preferences, and active app data
  • Only cleans truly orphaned caches from removed applications

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions