track when things were last seen
Track when users/things were last seen using redis.
This library is pretty experimental right now but does actually work, I'm just not sure how much of a good idea it is
Unlike some other "who is online" libraries which you might come across, this library does not expire keys (it can't because of Redis' current design) and is therefore unbounded in terms of memory consumption. If you keep on tracking new ids you will eventually run out of RAM.
This is completely by design, it's meant to track things for very long periods of time.
$ npm install online
var Lastseen = require'lastseen';var redis = require'redis';var client = rediscreateClientvar opts =redisKey: 'online' //name for redis key for setvar lastseen = Lastseenclient opts;lastseenaddsomeId//optional callback fired when written to redis//Check if a user is known aboutlastseenfindsomeId//err if redis failure//result is null for not known, or last seen timestamp for user
For now read the docblocks in
PRs, issues bugs, comments and general derision are welcome