/** * Получить юзера по логину * * @param string $sLogin Логин пользователя * @return ModuleUser_EntityUser|null */ public function GetUserByLogin($sLogin) { $s = strtolower($sLogin); if (false === ($id = $this->Cache_Get("user_login_{$s}"))) { if ($id = $this->oMapper->GetUserByLogin($sLogin)) { $this->Cache_Set($id, "user_login_{$s}", array(), 60 * 60 * 24 * 1); } } return $this->GetUserById($id); }
/** * Получить юзера по логину * * @param string $sLogin * * @return ModuleUser_EntityUser|null */ public function GetUserByLogin($sLogin) { $sLogin = mb_strtolower($sLogin, 'UTF-8'); $sCacheKey = "user_login_{$sLogin}"; if (false === ($nUserId = E::ModuleCache()->Get($sCacheKey))) { if ($nUserId = $this->oMapper->GetUserByLogin($sLogin)) { E::ModuleCache()->Set($nUserId, $sCacheKey, array(), 'P1D'); } } if ($nUserId) { return $this->GetUserById($nUserId); } return null; }