From d8b9d00fce853712cedeb5750cb974842c5707ae Mon Sep 17 00:00:00 2001 From: Lee Watson Date: Wed, 6 Jul 2016 00:02:21 +0100 Subject: [PATCH] Make view cache file-specific --- app/Http/Controllers/DownloadController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DownloadController.php b/app/Http/Controllers/DownloadController.php index a6ae9a7..93cd1bc 100644 --- a/app/Http/Controllers/DownloadController.php +++ b/app/Http/Controllers/DownloadController.php @@ -23,7 +23,7 @@ public function get(Request $request, Upload $upload) } if (!$request->user() || $request->user()->id !== $upload->user_id) { - $cacheKey = 'cached_view:' . $request->getClientIp(); + $cacheKey = sprintf('cached_view:%s:%s', $request->getClientIp(), $upload->hash); if (!Cache::has($cacheKey)) { Cache::put($cacheKey, 1, 60); DB::table('uploads')->where('id', $upload->id)->increment('views');