cache: Simplify its API and (probably) some bugfix

Probably has something todo with #62 and #67.