i_assert(field < cache->fields_count);
+ if (view->no_decision_updates)
+ return;
+
mail_index_lookup_uid(view->view, seq, &uid);
hdr = mail_index_get_header(view->view);
i_assert(field < cache->fields_count);
- if (MAIL_CACHE_IS_UNUSABLE(cache))
+ if (MAIL_CACHE_IS_UNUSABLE(cache) || view->no_decision_updates)
return;
if (cache->fields[field].field.decision != MAIL_CACHE_DECISION_NO) {
buffer_t *cached_exists_buf;
uint8_t cached_exists_value;
uint32_t cached_exists_seq;
+
+ unsigned int no_decision_updates:1;
};
struct mail_cache_iterate_field {
i_free(view);
}
+void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
+ bool update)
+{
+ view->no_decision_updates = !update;
+}
+
uint32_t mail_cache_get_first_new_seq(struct mail_index_view *view)
{
const struct mail_index_header *idx_hdr;
mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview);
void mail_cache_view_close(struct mail_cache_view *view);
+/* Normally cache decisions are updated on lookup/add. Use this function to
+ enable/disable this (useful for precaching data). */
+void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
+ bool update);
+
/* Get index transaction specific cache transaction. */
struct mail_cache_transaction_ctx *
mail_cache_get_transaction(struct mail_cache_view *view,