Make file caches more flexible

Summary:
  - Allow caller to set an acceptable lock wait time.
  - If we fail to lock and don't need to hold a lock for a write, just miss the cache.
  - See discussion in D5644.

Test Plan: I think I ran it? I'll actually check this in the next diff.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5657