Correct the logic of the is_protected cache check

We cache the remote GET request used to check whether attachments are protected,
with this cached value being checked before moving on to do the GET request.
The logic that is used to verify whether a cached value has been stored was
backward, however, resulting in some very slow lookups.

Many thanks to @brooks1man for help debugging this issue.

Fixes #422