perf: Tell browsers to cache storage stats endpoint as it is cached

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2024-06-18 23:00:17 +02:00
parent c3354e9c84
commit 40a416ba00
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

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;
}
/**