Skip to content

Commit 7a77b51

Browse files
committed
Cache the url
1 parent 17ea15b commit 7a77b51

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Http/Controllers/RedirectController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class RedirectController extends Controller
1616
*/
1717
public function redirect($code)
1818
{
19-
$url = Url::whereCode($code)->first();
19+
$url = \Cache::rememberForever("url.$code", function () use ($code) {
20+
return Url::whereCode($code)->first();
21+
});
2022

2123
if ($url !== null) {
2224
return redirect()->away($url->url, 301);

0 commit comments

Comments
 (0)