Merge pull request #45957 from nextcloud/perf/cache-storage-stats-header

perf: Tell browsers to cache storage stats endpoint as it is cached
This commit is contained in:
Richard Steinmetz 2024-06-19 08:10:24 +02:00 committed by GitHub
commit ab8556872e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,7 +238,9 @@ class ApiController extends Controller {
*/
public function getStorageStats($dir = '/'): JSONResponse {
$storageInfo = \OC_Helper::getStorageInfo($dir ?: '/');
return new JSONResponse(['message' => 'ok', 'data' => $storageInfo]);
$response = new JSONResponse(['message' => 'ok', 'data' => $storageInfo]);
$response->cacheFor(5 * 60);
return $response;
}
/**