Added tests for Cache.

Review: https://reviews.apache.org/r/19501