Skip to content

feat: global email body cache eviction#1257

Open
FromSi wants to merge 1 commit intofloatpane:masterfrom
FromSi:feature/email-body-cache-lru-limit
Open

feat: global email body cache eviction#1257
FromSi wants to merge 1 commit intofloatpane:masterfrom
FromSi:feature/email-body-cache-lru-limit

Conversation

@FromSi
Copy link
Copy Markdown
Contributor

@FromSi FromSi commented May 8, 2026

Closes #521

What?

Adds a configurable global size limit for cached email bodies.

  • Defaults body_cache_threshold_mb to 100 MB.
  • Applies the limit across the whole ~/.cache/matcha/email_bodies/ directory, not per folder cache file.
  • Evicts least recently accessed cached bodies until the total cache size is back under the limit.
  • Skips caching bodies larger than the configured limit.
  • Adds tests for cross-folder LRU eviction, multi-entry eviction, oversized replacements, and the default threshold.
  • Updates the seed script to generate 10 KB email bodies for cache testing.

Why?

Email body cache files could grow without a global cap for active users with large mailboxes. Existing pruning only removed bodies for emails no longer present in a folder, so valid cached emails could accumulate indefinitely. A global LRU limit keeps disk usage bounded while preserving recently used cached messages.

@FromSi FromSi requested a review from a team as a code owner May 8, 2026 12:23
@floatpanebot floatpanebot added area/config Configuration / settings area/docs Docs site / README labels May 8, 2026
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @FromSi! Please fix the following issues with your PR:

  • Title: Is too long (42 characters). The PR title must be strictly under 40 characters.

@floatpanebot floatpanebot added the enhancement New feature or request label May 8, 2026
@FromSi FromSi changed the title feat: add global email body cache eviction feat: global email body cache eviction May 8, 2026
@floatpanebot floatpanebot dismissed their stale review May 8, 2026 12:24

Formatting issues have been resolved. Thank you!

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

Labels

area/config Configuration / settings area/docs Docs site / README enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: Email body cache should have a size limit

2 participants