zendesk/ember-resource — pull request #64 by vcekov (2014-01-10 02:11:31+00:00)
Title: Expire instances from the identityMap

Rationale
-------------
Currently if we want to expire a model instance from its constructor's identity map (cache), we use the pattern:

```js
var idsToExpire = [10, 20, 30];
idsToExpire.forEach(function(id) {
MyModel.create({id: id}).expireNow();
});
```

This pattern has the disadvantage that for ids that do not belong in the identity map of ``MyModel``, we create unnecessarily instances of ``MyModel``. The unnecessary creation of instances also exhaust cache positions which may fill the cache with empty redundant objects and at the same time make the cache logic evict useful instances.

Usage
-------------
``findAndExpire`` can be invoked for a single instance:

``MyModel.findAndExpire(10)``

or for multiple instances:

``MyModel.findAndExpire([10, 20, 30])``

The example in the previous section can be rewritten like this:

```js
var idsToExpire = [10, 20, 30];
MyModel.findAndExpire(idsToExpire);
```

@jish @shajith @jamesarosen