Mmap cache

This is a resend of pull request #1.