Avoid an extra stat() call on cache lookups

Currently each cache lookup does stat() followed by open(). We can just
handle ENOENT from open() instead.
Create cache entries atomically in FilesystemCache

The filesystem cache needs to ensure entries only become visible once
they are completely written. Otherwise multiple processes sharing
a cache directory could see empty or incomplete files while they are
being written by another process. Fixes #313.

This patch uses the standard write-then-rename dance for POSIX systems.
I'm not sure if it works on Windows though...
Warn when cache files are unpickleable