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.
Merge pull request #104 from ianbarber/master

Fix potential locking issue and add a type check