title: Laravel Caching
body: <p>I have this function which retrieves the page's title of all urls of a website :</p>
  <pre><code>function getTitle($url)
          {
              $pages = file_get_contents($url);
              $title = preg_match('/&lt;title[^&gt;]*&gt;(.*?)&lt;\/title&gt;/ims', $pages, $match) ? $match[1] : null;
              return $title;
          }
  </code></pre>
  <p>Then I do a loop and it works perfectly (<a href="https://i.stack.imgur.com/PM9dt.png" rel="nofollow noreferrer">Good Results</a>), but I want to use a caching for 'file_get_contents', so I did :</p>
  <pre><code>function getTitle($url)
          {
              $pages = cache()-&gt;Cache::remember('key', now()-&gt;addDay(), fn() =&gt; file_get_contents($url));
              $title = preg_match('/&lt;title[^&gt;]*&gt;(.*?)&lt;\/title&gt;/ims', $pages, $match) ? $match[1] : null;
              return $title;
          }
  </code></pre>
  <p>On the one side the caching works (hyper fast now) but on the other side, all the titles are the same (<a href="https://i.stack.imgur.com/byI71.png" rel="nofollow noreferrer">Bad Results</a>).</p>
  <p>Where is my logic faulting ? This is the first time I'm using caching.</p>