Implement atomic increment/decrement in Cache library

Requested via issue #109
Supersedes PR #241