Shopify/identity_cache — pull request #135 by tjoyal (2014-03-11 21:10:57+00:00)
Title: Invalidate instance variable cache on reload

Assuming `ARecord.cache_has_many :b_records, :embed => true`
And `ARecord` has 2 `BRecord`
The nested cache invalidation mechanism work well when the modification is made through the relation
```
a = ARecord.first
a.fetch_b_records.count
=> 2
a.fetch_b_records.destroy_all
a.fetch_b_records.count
=> 0
```

But if the record is deleted outside the relation of the original object there is currently no way to bust the cache
```
a = ARecord.first
a.fetch_b_records.count
=> 2
ARecord.first.fetch_b_records.destroy_all
a.fetch_b_records.count
=> 2
a.reload
a.fetch_b_records.count
=> 2
```

This PR makes `reload` clear object instance internal cache. Object would have to retrieve a new copy of the cached object.