Shopify/identity_cache — pull request #178 by fbogsany (2014-09-09 14:30:37+00:00)
Title: Split should_cache? into should_use/should_update_cache?

`should_cache?` disables both using and updating the cache when `IdentityCache.readonly` is `true` or we're inside a transaction. This doesn't allow using IDC in a readonly fashion (e.g. from a diagnostic tool or maintenance task).

This PR splits `should_cache?` into `should_use_cache?` and `should_update_cache?`, and allows reading from IDC only when `should_use_cache?` is true, and allows writing to IDC only when `should_update_cache?` is true. `should_use_cache?` implies we're outside a transaction, `should_update_cache?` implies `should_use_cache?` and `!readonly`.

@camilo, @Shopify/webscale for review.