Inline storage preview cache control

This commit is contained in:
Chirag Aggarwal
2026-05-08 09:59:36 +05:30
parent bf76736971
commit 5841d0a944
+3 -8
View File
@@ -642,7 +642,7 @@ Http::init()
$data = $cache->load($key, $timestamp);
if (! empty($data) && ! $cacheLog->isEmpty()) {
$storageCacheControl = null;
$cacheControl = \sprintf('private, max-age=%d', $timestamp);
$parts = explode('/', $cacheLog->getAttribute('resourceType', ''));
$type = $parts[0];
@@ -697,7 +697,7 @@ Http::init()
}
if ($isImageTransformation) {
$storageCacheControl = new StorageCacheControl(
$cacheControl = $cacheControlForStorage(new StorageCacheControl(
source: CacheControl::SOURCE_CACHE,
user: $user,
maxAge: $timestamp,
@@ -709,7 +709,7 @@ Http::init()
fileSecurity: $fileSecurity,
cacheLog: $cacheLog,
route: $route,
);
));
}
}
@@ -722,11 +722,6 @@ Http::init()
$cache->save($key, $data);
}
$cacheControl = \sprintf('private, max-age=%d', $timestamp);
if ($storageCacheControl !== null) {
$cacheControl = $cacheControlForStorage($storageCacheControl);
}
$response
->addHeader('Cache-Control', $cacheControl)
->addHeader('X-Appwrite-Cache', 'hit')