1. What is session

A special object created by the server to hold user status.

2. Understanding session

The session exists on the server. Cookies exist in the browser. The session generates a unique key and returns the key. The key is set in the cookie of the user. Each time the browser requests, the cookie is automatically carried, and the key is searched in the cache or external store to obtain the value stored in the session.

3. Source code process analysis

Problem 4.

Why id = await store.getid (24); I’m going to reassign here

Set (ctx.session, object.assign ({}, opts, {sid: ID}), CTX); The generated ID is duplicated and does not update