|
@@ -125,4 +125,21 @@ public class TokenServiceImpl implements TokenService {
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除用户token
|
|
|
+ * @param userId 用户ID
|
|
|
+ * @return 删除是否成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteToken(String userId){
|
|
|
+ final byte[] redis_key = getUserTokenKey(userId);
|
|
|
+ Long l = (Long) redisForToken.execute(new RedisCallback<Long>() {
|
|
|
+ @Override
|
|
|
+ public Long doInRedis(RedisConnection connection) throws DataAccessException {
|
|
|
+ return connection.del(redis_key);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return l > 0;
|
|
|
+ }
|
|
|
}
|