In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Application background
The names of multiple applications are assumed to be An and B, which prohibit users from logging in from A / B at the same time.
Realization idea
Set two unordered sets a_set, b_set
A / b executes when logging in
$redis- > sAdd ('ajar setter sRem); / A log in to $redis- > sRem (' bouncy setter dagger camera UserID); / / kick Blockrediss-> sAdd ('bouncy setter requlibility UserID); / B Log in to $redis- > sRem (' aholysetter reflexive UserID); / / kick A
Before api acquires data, determine whether the id of this end is online (the api of the two sides of the AB is separate)
A judgment:
If ($redis- > sIsmember) {/ / true} else {/ / false}
B judgment
If ($redis- > sIsmember ('baked setbacks grammatical user ID)) {/ / true} else {/ / false}
The methods used are:
When the sadd key_set value setting value is set to the sismember key_set value judgment value in set, there is a srem key_set value in key_set to remove the specified value smembers key_set to get all value.
The above are the details of the method of prohibiting multi-side login based on Redis unordered collection, please pay more attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.