Token has an expiration date, once it has expired to delete it, how to automatically delete it? The backstage is written in PHP.
Reply content:
Token has an expiration date, once it has expired to delete it, how to automatically delete it? The backstage is written in PHP.
Save to Redis, set obsolete
Token validity Long Direct Deposit db, run job processing; short-term cache caching, whether it's a dedicated cache or a memory cache look at the amount of data and the financial resources.
Token has an expiration date, once it has expired to delete it, how to automatically delete it? The backstage is written in PHP.
Both client and server authenticate user login
Token is saved with a time-out expire. For example, if the login is invalid after 7,200 seconds, the PHP server will send token and time () +7200 parameters to the client when the login is successful. This only needs to check whether the current time is greater than expire can determine whether the login is still valid, do not need to delete manually.
At the same time, when the server login is successful, a session with expiration time is set, which can determine whether the user's login information is still valid by the presence of the session.
No need to save the database, you can search under Discuz encryption decryption