Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Commit

Permalink
option to disable caching from .env
Browse files Browse the repository at this point in the history
  • Loading branch information
BostjanOb committed Aug 26, 2015
1 parent 62fc8d3 commit 41c190a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/responseCache.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

return [
'enabled' => env('RESPONSE_CACHE_ENABLED', true),

/**
* Cache key defined in cache.php settings
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/CacheMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CacheMiddleware
public function handle($request, Closure $next)
{
// only get methods are allowed
if ( $request->isMethod('get')) {
if ( $request->isMethod('get') && config('responseCache.enabled') ) {
$key = config('responseCache.key_prefix') . $request->fullUrl();

$response = \Cache::store( config('responseCache.cache_store') )->get($key);
Expand Down

0 comments on commit 41c190a

Please sign in to comment.