Skip to content
Tildev0.6.1

The mail cache

This page shows how to turn on the mail cache, encrypt it and limit its size. The cache keeps a copy of what Tilde reads, so a big remote mailbox is faster to list and you can search it. The complete list of keys is in config.toml: cache, pgp.

The cache writes mail on your disk, so it is off until you turn it on:

[cache]
enabled = true
size_max = "1GB"
encrypt_key = "#{pass show tilde/cache}"
Key Meaning Default
enabled Turns the cache on. false
size_max The largest size of the cache file of one account. "1GB"
encrypt_key The key that encrypts the cache files. none, not encrypted

size_max is a number and a unit, KB, MB or GB, in any case: "500MB", "1.5 GB". A number without a unit is an error, and tcli check shows it. A kilobyte is 1,024 bytes.

  • The headers of the folders you opened, and the list of the folders.
  • The whole message once you open it. A message you opened is still readable when the server is not reachable.
  • An index of the sender, the subject and the body, for the search.
  • One file for each account, cache/<id>.db in the root folder of Tilde (~/.config/tilde/cache by default). The id of the account is the name of the file, so an id with other characters than letters, digits, ., _ and - gets no cache.

IMAP accounts keep all of this. A Maildir account is already on your disk, so its cache is an index for the search only. Chat is not cached.

With encrypt_key the whole file is encrypted, the index included: the subjects, the senders and the bodies are not readable in the file. Only the cache is protected. The configuration and the logs stay readable.

Keep the key in a password manager and read it with #{command} or ${NAME}: see Passwords. Without a key the file is a normal SQLite file, and Tilde logs one warning when it starts (see Logging and jobs).

  • A wrong or changed key, or a file that is not a cache: the cache of that account stays off, the file is not touched and the log says which file. The store works without the cache.
  • A key added to a plain cache: the file is made again, encrypted and empty.
  • Key rotation is not supported. After you change the key, delete the old file with tcli cache reset <account>.

After a message is saved, the cache drops the whole messages that were used least, oldest first, until the file is a little under size_max. Headers, folders and the index of senders and subjects are never dropped. A message larger than the limit is read through and not kept.

Put cache = false in the store settings of the account. no, off and 0 mean the same.

[accounts.mail.store.settings]
host = "imap.example.org"
cache = false

The search covers what the cache holds. These commands fill it and search it with Tilde closed, because two programs would write the same file:

Terminal window
tcli cache rebuild work
tcli cache search work "fat nov"

Every word must match and each one matches as a prefix, so fat nov finds “Fattura di novembre”. The details of the four tcli cache commands are on The cache.