Answer the question
In order to leave comments, you need to log in
How to organize user sessions with Redis?
Introductory
- Only one user can sit under one account
- The session has a lifetime = 48h
- Tokens are needed in order to process API requests
Option: Put the token and user identifier (id) in Redis, and also set the TTL, after which the record is removed. On every request (GET/POST/PUT/DELETE) we update the token.
Questions
Answer the question
In order to leave comments, you need to log in
1. A very acceptable option.
2. There is no such tool. Select all keys by mask, then compare values. That is, all your sessions should look something like this sessions:session_id , make a selection of keys by the sessions:* mask and search for the desired value by enumeration.
On every request (GET/POST/PUT/DELETE) we update the token.you need to update TTL for writing
If there are few sessions, then postgres will also go, it’s just that postgres will lie on its back for a thousand connectors, and the radish will not sneeze further
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question