GithubHelp home page GithubHelp logo

user-tracker's Introduction

User Tracker

Library for displaying current (logged in) users of your application.

Designed so as to be non-blocking on writes and reads, and to perform as few database operations as possible in the background. (i.e., it's supposed to be cheap to use!)

Usage

Persistence

Persistence allows your logged in user data to be propagated across a set of servers.

Either implement the Persistence layer yourself or use the provided DynamoDBPersistence with DynamoDB.

val persistence = DynamoDBPersistence(
  client = new AmazonDynamoDBAsyncClient(),
  tableName = "application_users"
)

If using DynamoDBPersistence make sure to start the GC cycle:

DynamoDBPersistence.startGarbageCollection(persistence, frequency = 5 minutes)

User Tracking

Create a single instance of UserTracker at application start up:

val userTracker = new UserTracker(
  persistence
)

Trigger the scheduled updates to the persistence layer at start up:

UserTracker.startPersistence(userTracker)

Tell the user tracker when you see a user:

userTracker.recordSeenNow(UserId("robert"))

Ask the user tracker for the currently active users:

val users = userTracker.currentlyActive

License

Copyright Guardian News & Media. Licensed under Apache 2.0.

user-tracker's People

Contributors

robertberry-zz avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.