Example #1
0
 /**
  * @param $contentPartnerId
  * @param $externalUserId
  * @return null|ExternalUserModel
  */
 public function getExternalUserByContentPartnerIdAndExternalUserId($contentPartnerId, $externalUserId)
 {
     $userIdentifier = $contentPartnerId . ':' . $externalUserId;
     $externalUser = $this->dataProvider->getExternalUserFromRedisByUserIdentifier($userIdentifier);
     if (!$externalUser) {
         $data = $this->dataProvider->findExternalUserByContentPartnerIdAndExternalUserId($contentPartnerId, $externalUserId);
         if ($data) {
             $externalUser = ExternalUserModel::createFromArray($data);
             $this->dataProvider->setExternalUserToRedis($externalUser);
         }
     }
     return $externalUser;
 }
Example #2
0
 /**
  * @param $userIdentifier
  * @return null|ExternalUserModel
  */
 public function getExternalUserFromRedisByUserIdentifier($userIdentifier)
 {
     $externalUser = null;
     $data = json_decode($this->redis->get($this->buildKeyByUserIdentifier($userIdentifier)), true);
     if ($data) {
         $externalUser = ExternalUserModel::createFromArray($data);
     }
     return $externalUser;
 }