I just want to ask, generally, where are the text message verification codes sent by the server stored, such as session, database, or other places? Why is this design? Thanks. I just want to ask, generally, where are the text message verification codes sent by the server stored, such as session, database, or other places? Why is this design? Thank you.
Reply content:
I just want to ask, generally, where are the text message verification codes sent by the server stored, such as session, database, or other places? Why is this design? Thank you.
I still prefer to put it in redis. After all, access is fast and it can automatically expire.
Session
Cause: You can discard it after verification. Verification code-compliant features
If the session has a server time limit, it will be deleted on time.
Sessions, of course, can be stored in databases and non-relational databases.
First question:
For common functions, we recommend that you setAccess_Token Field, Which can be used to put the following information:
1. Forget the password-retrieve the password verification code from the mailbox;
2. Mobile phone verification code;
3. Other verification information;
This design is simpler and more flexible. The only thing to note is the mutex of the business.
Second question:
By default, sessions are stored as files and can be stored in databases and NoSQL. We recommend that you use Redis because of the high access speed.
Even if it is designed in the futureREST Interface,AppidAnd Access_Token We recommend that you directly store the key information in Redis.
Redis, fast access, and server support.
Personal suggestions for redis
I personally think that the RESTful architecture like APP interfaces should avoid using sessions as much as possible.
In addition, there is not much pressure on this part, and the database can basically be done, And Redis can also be done.
Above.