public function add($file, $force = false)
    {
        if (!file_exists($file)) {
            throw new \InvalidArgumentException(sprintf('File "%s" does not exist.', $file));
        }

        if (false === $force && null !== $path = $this->getCache($file)) {
            return null === $this->target ? $path : $this->target.'/'.$path;
        }

        $name = $this->findAvailableName($file);

        if (null !== $this->cache) {
            $this->cache->set(md5($file), serialize(array(filemtime($file), $name)));
        }

        if (!is_dir($dir = dirname($target = $this->directory.'/'.$name))) {
            mkdir($dir, 0777, true);
        }

        if (false === @copy($file, $target)) {
            throw new \RuntimeException(sprintf('Error while copying "%s" to "%s".', $file, $target));
        }

        return null === $this->target ? $name : $this->target.'/'.$name;
    }