Extracted common store caching code into storecache.