mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Inline storage preview cache control
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user