Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The Life Of a User Session

138 views

Published on

Jan Kleinert at Redis Day NYC 2019

Published in: Technology
  • Be the first to comment

  • Be the first to like this

The Life Of a User Session

  1. 1. PRESENTED BY
  2. 2. PRESENTED BY
  3. 3. PRESENTED BY
  4. 4. PRESENTED BY 1 What are sessions? 2 Adding session management to a web app 3 What comes next? Agenda:
  5. 5. PRESENTED BY What are sessions? Request Request Response Response
  6. 6. PRESENTED BY Session ID Session Store Session ID and Session Data
  7. 7. PRESENTED BY Let’s look at an example!
  8. 8. PRESENTED BY express-session + connect-redis app.use(session({ genid: (req) => { return uuid() }, store: new redisStore({ host: 'localhost', port: 6379, client: redisClient }), name: '_redisDemo', secret: process.env.SESSION_SECRET, resave: false, cookie: { secure: false, maxAge: 60000 }, // Set to expire in 1 minute for demo purposes saveUninitialized: true }))
  9. 9. PRESENTED BY But what about authentication?
  10. 10. PRESENTED BY What did we add?
  11. 11. PRESENTED BY
  12. 12. PRESENTED BY You can use Redis as a cache and a session store! https://redislabs.com/blog/cache-vs-session-store/
  13. 13. PRESENTED BY Example repo: https://github.com/jankleinert/redis-session-demo Modules used in these examples: • express-session: https://www.npmjs.com/package/express-session • connect-redis: https://www.npmjs.com/package/connect-redis • uuid: https://www.npmjs.com/package/uuid • passport: https://www.npmjs.com/package/passport Cache vs. Session Store blog: https://redislabs.com/blog/cache-vs-session-store/ Redis Enterprise Operator: https://github.com/RedisLabs/redis-enterprise-k8s-docs Try the operator mini-lab: http://bit.ly/2NgxBaK Find me on Twitter/Github: jankleinert Resources
  14. 14. Thank you! Thank you!

×