Fix revalidation logic to match the spec

Add tests for said logic
Merge pull request #23 from m3dev/feature/fix-cache-revalidation-logic

Fix revalidation logic to match the spec