E.g., for CircleCI: before loading/saving your cache run cat patches/* | md5 > patches.hash
and then update your hash key to include a checksum of that file,
{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}.
This recommendation is either outdated or incorrect, because md5 appears to be not available in CircleCi:
#!/bin/bash -eo pipefail
cat patches/* | md5 > patches.hash
/bin/bash: md5: command not found
Exited with code exit status 127
CircleCI received exit code 127