Create a new session for a user. Args: user_id (UUID): The user ID to associate with the session Returns: Session: The newly created session
(cls, user_id: UUID)
| 63 | |
| 64 | @classmethod |
| 65 | def create(cls, user_id: UUID) -> 'Session': |
| 66 | """ |
| 67 | Create a new session for a user. |
| 68 | |
| 69 | Args: |
| 70 | user_id (UUID): The user ID to associate with the session |
| 71 | |
| 72 | Returns: |
| 73 | Session: The newly created session |
| 74 | """ |
| 75 | session = cls(uuid4(), user_id) |
| 76 | cache.setex(_make_key(session.session_id), AUTH_SESSION_EXPIRY, str(session.user_id)) |
| 77 | return session |
| 78 | |
| 79 | def extend(self) -> None: |
| 80 | """ |