What about the Token validation cache?

< H1 > problem description < / H1 >
now you need to do token verification. The client submits the client id and the client key. After passing the verification, the server obtains the configuration expiration time from the configuration file, then generates a GUID as access_token, stores the access_token in the cache, and sets the expiration time of the cache. Finally, the access_token and expiration time are assembled into JSON and returned to the client.
< H1 > problems to be solved < / H1 >
how to do this cache and set the expiration time, is it using redis? How do you do that? Is the simplest verification, how to store the UUID and time in the cache, and then let the search for verification, after expiration, return 401 to get the token.

put Redis. When storing Redis values, you can naturally set the expiration time without making other additional judgments.
validate the value directly to Redis. If no value expires, return the frontend
to store token. All other caches are OK, and so is Map. But once the service is restarted, the previous token will lose


if the stand-alone service tries it, you can consider putting it directly in the memory of the program and using Google's open source tool, Guava. For example, this article says
https://mp.weixin.qq.com/s/d3...
. If it is a cluster, consider using Redis. For the same reason, directly use the form of Kmuri v, set an expiration time, and check whether it exists to determine whether it is valid


setex 
.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30be8-2bd22.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30be8-2bd22.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?