/** * Добавляет трэк в redis * * @param Tracks $track * @return int */ public function addTrack(Tracks $track) { if ($track->getIsNewRecord()) { $track->id = $this->redis()->incr(self::KEY_SEQUENCE); } $attrs = $track->getAttributes(); foreach ($attrs as $k => $v) { if ($v === null) { unset($attrs[$k]); } } $this->redis()->hMset($this->getTrackKey($track->id), $attrs); return $track->id; }