Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
Make view cache file-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
TheReverend403 committed Jul 5, 2016
1 parent 43d37e6 commit d8b9d00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit d8b9d00

Please sign in to comment.