Skip to content

FEAT: Email body cache should have a size limit #521

Closed

Description

@andrinoff

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.

Activity

  1. moved this from Backlog to In review in v1 Releaseon May 8, 2026
  2. moved this from In review to Done in v1 Releaseon May 10, 2026
  3. mavonx commented on May 11, 2026

    @mavonx
    Member

    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?

  4. andrinoff commented on May 11, 2026

    @andrinoff
    MemberAuthor

    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

  5. mavonx commented on May 11, 2026

    @mavonx
    Member

    @andrinoff

    Is the only difference that the cache is now global across all folders instead of per-folder?

  6. andrinoff commented on May 11, 2026

    @andrinoff
    MemberAuthor

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions