Add more test cases for cache API for invalidation

Resolves #46.