Browse Source

Cache json package views for 1hour, fixes #295

Jordi Boggiano 12 years ago
parent
commit
48ccc20ff6
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Packagist/WebBundle/Controller/WebController.php

+ 5 - 1
src/Packagist/WebBundle/Controller/WebController.php

@@ -472,7 +472,11 @@ class WebController extends Controller
                 $data['favers'] = null;
             }
 
-            return new Response(json_encode(array('package' => $data)), 200);
+            // TODO invalidate cache on update and make the ttl longer
+            $response = new Response(json_encode(array('package' => $data)), 200);
+            $response->setSharedMaxAge(3600);
+
+            return $response;
         }
 
         $version = null;