Esempio n. 1
0
File: Activity.php Progetto: rjha/sc
 function removeFollower($followerId, $followingId)
 {
     //f1->f2 (f1 is no longer following f2)
     if ($followerId == $followingId) {
         return;
     }
     $redis = Redis::getInstance()->connection();
     $key1 = Nest::following("user", $followerId);
     $key2 = Nest::followers("user", $followingId);
     $key3 = Nest::score("user", "followers");
     $key4 = Nest::score("user", "followings");
     // remove $followerId from $followingId's followers set
     // remove $followingId from $followerId's following set
     $redis->pipeline()->srem($key1, $followingId)->srem($key2, $followerId)->zincrby($key3, -1, $followingId)->zincrby($key4, -1, $followerId)->uncork();
 }