Update to newer async cache API for compatibility with newer Thunderbirds.

Note: Indentation could be tidier - there is a mix of tabs and spaces
and I couldn't determin any specific style. I left some bits that should
be indented at their parent level to avoid contextual changes in the
patch