SHA processing bug fix and cache timeout feature

Rebased pull request on main per #404.