public function shouldSample()
    {
        // We will store the microtime timestamp in the cache because some
        // cache implementations will not let you use expiry for anything less
        // than 1 minute
        if ($item = $this->cache->getItem($this->key)) {
            if ((float) $item->get() > microtime(true)) {
                return false;
            }
        }

        $item = new $this->cacheItemClass($this->key);
        $item->set(microtime(true) + 1.0 / $this->rate);

        // TODO: what if the cache fails to save?
        $this->cache->save($item);

        return true;
    }