Fix potential locking issue and add a type check

Type check the request cache response as that is the bulk of the usage,
and add an improvement to the locking to avoid potential contention issues.

Hopefully will address the issues seen in #101 - though I don't have a reliable repro at the moment.