Thanks Aki,

Just a followup regarding this. I set  "mail_always_cache_fields" to the following in dovecot configuration file: 

mail_cache_fields = flags,imap.body,imap.bodystructure
mail_always_cache_fields = imap.body,imap.bodystructure

I run the following command to ensure that these configurations have an effect on the caching behavior: 

doveadm index -u bob INBOX

I notice that "data->wanted_fields" in index-mail.c is as follows: 

(MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY | MAIL_FETCH_RECEIVED_DATE | MAIL_FETCH_SAVE_DATE | MAIL_FETCH_PHYSICAL_SIZE | MAIL_FETCH_VIRTUAL_SIZE | MAIL_FETCH_UIDL_BACKEND | MAIL_FETCH_GUID | MAIL_FETCH_POP3_ORDER)

Since I made the changes above I except  data->wanted_fields to contain MAIL_FETCH_IMAP_BODY and MAIL_FETCH_IMAP_BODYSTRUCTURE. This tells me that these fields are not being cached? 

Am I doing something wrong here?



On 19 March 2018 at 02:33, Aki Tuomi <aki.tuomi@dovecot.fi> wrote:


On 19.03.2018 05:14, Sivathmican Sivakumaran wrote:
> Hello,
>
> It looks like the "mail_always_cache_fields" and
> "mail_never_cache_fields" can be used to control dovecot's caching
> decisions. I cannot seem to find any documentation regarding how these
> fields should be used.
>
> What are acceptable values for these fields? I am quite new to this so
> any help would be much appreciated. 
>
> Regards,
>
> Siva

Hi!

You can use the same field names as for 'doveadm fetch'. Please note
though that you need to rm dovecot.index.cache file after changes, this
has only been fixed in 2.2.34 dovecot release.

Aki