Shopify/identity_cache — pull request #141 by Thibaut (2014-04-02 20:26:34+00:00)
Title: Fetch in batches

**Problem:**

`SystemStackError: stack level too deep` is raised when attempting to fetch more records than the max stack size. This is caused by the use of splats:

```
2.1.0p0 :001 > def foo(*args); end
2.1.0p0 :002 > foo(*(1..1_000_000).to_a)
SystemStackError: stack level too deep
```

**Solution:**

- Accept an array of ids in addition to a collection ids in `#fetch_multi`
- Stop using splats internally when calling `#fetch_multi`
- Call `ActiveSupport::Cache::Store#read_multi` in batches because it only accepts a collection (not array) of keys

I set the default batch size to 1,000, which might be a bit low.

@csaunders @camilo @pushrax