caching: initial implementation
caching: invalidate when pragmas change
caching: invalidate when sections change
caching: move support code to its own module
caching: better names for functions