public function getType($id)
    {
        if (null === $id) {
            // The caller might call us using a row from database that contains
            // a strict null, it is useless for us to do any query since null
            // typed messages are valid by the MessageInterface signature
            return null;
        }

        if (null === $this->types) {
            $this->loadCache();
        }

        if (!isset($this->types[$id])) {
            // Someone may have created it before we loaded the cache
            $this->loadCache();

            if (!isset($this->types[$id])) {
                // It seems that the type really does not exists, mark it as
                // being wrong in order to avoid to refresh the cache too often
                // and return a null type
                $this->types[$id] = false;
            }
        }

        if (false === $this->types[$id]) {
            return null;
        } else {
            return $this->types[$id];
        }
    }