WIP: Invalidate cache entries when ref changes

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>