Skip to content

Instantly share code, notes, and snippets.

@stephen
Created December 9, 2014 23:09
Show Gist options
  • Save stephen/f6538573bd3fc5d12492 to your computer and use it in GitHub Desktop.
Save stephen/f6538573bd3fc5d12492 to your computer and use it in GitHub Desktop.
var session = yield Session.generate({ user: 'stephen' });
var token = session.token;
session.expirationTime = Date.now();
yield session.save();
// re-fetch
var fetchedSession = yield Session.load(token);
// do something witht the newly fetched instance
assert.equals(fetchedSession.user, 'stephen');
yield fetchedSession.delete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment