public function addVisitor(UserInterface $user, Request $request)
    {

        $days = 30;
        $ip = $request->getClientIp();
        $data = $this->getVisitors();
        $date = new \DateTime();
        $currTimestamp = $date->getTimestamp();
        // entries should be only hourly
        $date->setTime($date->format('H'), 0, 0);
        $todayTimestamp = $date->getTimestamp();

        if (!isset($data[$todayTimestamp])) {
            $data[$todayTimestamp] = array();
        }

        $type = $user->getSymbbType();

        $currVisitor = array(
            'id' => $user->getId(),
            'type' => $type,
            'ip' => $ip,
            'lastVisiting' => $currTimestamp
        );

        $overwriteKey = null;

        // remove entries who are to old
        $maxOldDate = new \DateTime();
        $maxOldDate->setTime(0, 0, 0);
        $maxOldDate->modify('-' . $days . 'days');
        foreach ($data as $timestamp => $tmp) {
            if (!is_numeric($timestamp) || $timestamp < $maxOldDate->getTimestamp()) {
                unset($data[$timestamp]);
            }
        }

        foreach ($data[$todayTimestamp] as $key => $visitor) {

            if (
                // case 1: guest -> check ip
                (
                    $currVisitor['type'] == 'guest' &&
                    $visitor['type'] == $currVisitor['type'] &&
                    $visitor['ip'] == $currVisitor['ip']
                ) ||
                // case 2: user -> check id ( can login with different ips )
                (
                    $currVisitor['type'] == 'user' &&
                    $visitor['type'] == $currVisitor['type'] &&
                    $visitor['id'] == $currVisitor['id']
                )
            ) {
                $overwriteKey = $key;
                break;
            }
        }

        // if we have found the same visitor in the data
        // then we will overwrite it
        // if not we will add the vistor
        if ($overwriteKey !== null) {
            $data[$todayTimestamp][$overwriteKey] = $currVisitor;
        } else {
            $data[$todayTimestamp][] = $currVisitor;
        }

        // sort
        ksort($data, SORT_NUMERIC);
        // reverse so that the newest are the first
        $data = array_reverse($data, true);

        $this->memcache->set(self::MEMCACHE_VISITOR_KEY, $data, (86400 * $days)); // 30 days valid
    }