protected function addToCache($requestUri)
    {
        // we found our match, stop looking for more and add to cache if cache is configured
        if ($this->cache instanceof Cache) {
            // prepare info to be saved to cache
            $toCache = [
                'matchedRoute' => $this->matchedRoute,
                'matchedEndpoint' => $this->matchedEndpoint,
                'params' => $this->params
            ];

            // check if we have any routes saved
            if ($cachedRoutes = $this->cache->get('routeMiddlewareRoutes')) {
                // add this route to cache
                $cachedRoutes[$requestUri] = $toCache;
            } else {
                // no routes found in cache, this is the first one we save
                $cachedRoutes = [
                    $requestUri => $toCache
                ];
            }
            // save to cache
            $this->cache->set('routeMiddlewareRoutes', $cachedRoutes);
        }
    }