public function set($key, $value, $ttl)
    {
        $this->initializeOnDemand();

        if (!is_string($key)) {
            throw new InvalidArgumentException(sprintf('Argument #1 must be a string and only, received "%s"', gettype($key)));
        }

        $time = time();

        if ($this->has($key)) {
            $this->cacheMapper->update($key, $value, $ttl);
        } else {
            $this->cacheMapper->insert($key, $value, $ttl, $time);
        }

        // For the current request
        $this->cache[$key] = array(
            ConstProviderInterface::CACHE_PARAM_VALUE => $value,
            ConstProviderInterface::CACHE_PARAM_CREATED_ON => $time,
            ConstProviderInterface::CACHE_PARAM_TTL => $ttl
        );

        return true;
    }