jashkenas/underscore — pull request #1626 by loc (2014-05-05 18:32:15+00:00)
Title: Memoize cache expiration

I would find it very useful to have a cache function for many things, including querying the DOM, AJAX polling, etc. Instead of adding another function to the library, I propose adding an optional cache lifetime (in milliseconds) parameter to `_.memoize` and simply aliasing as `_.cache`.

It makes a lot more sense for expensive synchronous requests (like DOM polling), but here's an AJAX example. This specific example could also use throttling, but you get the idea.

http://jsfiddle.net/JZGeb/