Added cache expiration and test code (fixes #6)