Added tests for the new caching functionality.

125/135 tests pass.