Conversation
There was a getter for the cache limit and none for what is in it, so a client could show the ceiling but not how close to it the cache was. Summed from the cache index, in bytes on disk, which is the measure the limit is in and the one eviction compares against.
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a getter for the attachment cache's limit and none for its current usage, so a client can show the ceiling but not how close it is. "2.1 GB of 5 GB" needs both halves.
attachment_cache_size()is added in the same two forms asattachment_cache_limit, returning bytes.It sums the
attachment_cacheindex, so it is bytes on disk: the same measure the limit is in, and the same total eviction compares against — which is what makes the two worth showing side by side. Display pictures are excluded, exactly as they are from the limit. Reading the index rather than walking the directory costs a query, and is exact only for as long as the index is: a file deleted from under us still counts until the sweepset_cache_dirstarts finds it gone.Tests: a new case in
tests/test_client/attachments.cpp— 0 before anything is cached, then the sum of the cached files' sizes on disk after each of two arrivals.Built and run against the client suite: 135 cases, 1012 assertions, passing.
Independent of the two PRs alongside it and mergeable in any order.
Note:
tests/static-bundle-testfails to link onclientalready, before this change (undefined reference to SQLite::Database::exec). Unrelated and untouched.