BryanDonovan/node-cache-manager — pull request #14 by nguyenchr (2014-10-15 10:00:14+00:00)
Title: Set ttl in wrap

This allows different ttl values to be set per function that is being wrapped

For example

```javascript
var getShortLivedField = function(id, callback) {
...
}

var getLongLivedField = function(id, callback) {
...
}

app.get('/short/lived', function(req, res) {
var cache_key = "short:" + req.params.id;
var ttl = 1;
cache.wrap(cache_key, function(cache_cb) {
getShortLivedField(req.params.id, cache_cb);
}, ttl, function(err,result){
res.send(result);
});
})

app.get('/long/lived', function(req, res) {
var cache_key = "long:" + req.params.id;
var ttl = 600;
cache.wrap(cache_key, function(cache_cb) {
getLongLivedField(req.params.id, cache_cb);
}, ttl, function(err,result){
res.send(result);
});
})
```

`ttl` is optional in `wrap()`, if it is not passed in then `cache.set` will be called with a `ttl` of `undefined`