Skip to content

allow to pass ttl in callback of wrapped function #46

Description

@dcolens

sometimes the lookup of a value will also yield its expiration time. It would be nice that the callback of the work function allows for a third ttl param, for example :

function work(callback) {
  callback(null, { a: 'foo' }, '10s');
}

cache.wrap('foo', work, function (err, data) {
  console.log(data); //-> {a: 'foo'}
});

am not sure how this would work for Promises?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions