NeoMutt  2020-06-26-30-g76c339
Teaching an old dog new tricks
HCACHE: Header cache API

The Header Cache saves data from email headers to a local store in order to speed up network mailboxes.

See also
STORE: Key value store
COMPRESS: Data compression


When NeoMutt parses an email, it stores the results in a number of structures (listed below). To save time and network traffic, NeoMutt can save the results into a STORE: Key value store (optionally using COMPRESS: Data compression).

See also
Address Body Buffer Email Envelope ListNode Parameter

To save the data, the Header Cache uses a set of 'dump' functions (Email-object serialiser) to 'serialise' the structures. The cache also stores a CRC checksum of the C structs that were used. When retrieving the data, the Header Cache uses a set of 'restore' functions to turn the data back into structs.

The CRC checksum is created by hcache/ during the build process. Whenever the definition of any of the structs changes, the CRC will change, invalidating any existing cached data.

Adding or removing a field from the set of serialised fields will not affect the CRC. In this case, it is vital that you bump the **BASEVERSION** variable in hcache/


File Description
hcache/hcache.c Header cache multiplexor
hcache/serialize.c Email-object serialiser
Function Description
mutt_hcache_close() close the connection to the header cache
mutt_hcache_delete_header() delete a key / data pair
mutt_hcache_fetch() fetch and validate a message's header from the cache
mutt_hcache_free_raw() free data fetched with mutt_hcache_fetch_raw()
mutt_hcache_open() open the connection to the header cache
mutt_hcache_store() store a Header along with a validity datum