Some code clean-up to the cache API.