+
+ return $request->getMethod().' '.$path;
+ }
+
+ /**
+ * Checks whether the given (cached) response may be served as "stale" when a revalidation
+ * is currently in progress.
+ *
+ * @param Response $entry
+ *
+ * @return bool true when the stale response may be served, false otherwise
+ */
+ private function mayServeStaleWhileRevalidate(Response $entry)
+ {
+ $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate');
+
+ if (null === $timeout) {
+ $timeout = $this->options['stale_while_revalidate'];
+ }
+
+ return abs($entry->getTtl()) < $timeout;
+ }
+
+ /**
+ * Waits for the store to release a locked entry.
+ *
+ * @param Request $request The request to wait for
+ *
+ * @return bool true if the lock was released before the internal timeout was hit; false if the wait timeout was exceeded
+ */
+ private function waitForLock(Request $request)
+ {
+ $wait = 0;
+ while ($this->store->isLocked($request) && $wait < 100) {
+ usleep(50000);
+ ++$wait;
+ }
+
+ return $wait < 100;