FEAT: Email body cache should have a size limit
Is your feature request related to a problem?
Email bodies are cached to disk via config.SaveEmailBody() with no global size limit or eviction policy. For active users with large mailboxes, the ~/.cache/matcha/email_bodies/ directory can grow to hundreds of megabytes or more over time.
Describe the solution you'd like
Implement a cache size limit with LRU eviction:
- Set a configurable maximum cache size (e.g. default 100MB)
- When the limit is reached, evict the least recently accessed entries
- Alternatively, use time-based expiration (e.g. evict entries older than 30 days)
Describe alternatives you've considered
Manual cache clearing by the user (rm -rf ~/.cache/matcha/email_bodies/). This works but is not user-friendly and clears everything.
Additional context
The existing PruneStaleBodyCache function only removes bodies for UIDs no longer in the folder email list — it doesn't limit total cache size.
Hi @andrinoff,
It seems I already solved this issue before in #1171 and #1227.
So I can’t understand what the difference is. I think my work may have just been overwritten?
Hi @andrinoff,
It seems I already solved this issue before in #1171 and #1227.
So I can’t understand what the difference is. I think my work may have just been overwritten?
It was improved in #1257 by @FromSi
@andrinoff
Is the only difference that the cache is now global across all folders instead of per-folder?
@andrinoff
Is the only difference that the cache is now global across all folders instead of per-folder?
also a more robust multi-email caching, where it fails less, than you're variation did