Tweaks to post & thumbnail caching
This commit is contained in:
parent
45674f74bf
commit
dc4af58d31
1 changed files with 8 additions and 2 deletions
|
@ -703,9 +703,10 @@ class PostController
|
|||
if (!is_readable($path))
|
||||
throw new SimpleException('Thumbnail file is not readable');
|
||||
|
||||
$ttl = 60 * 60 * 24 * 3;
|
||||
\Chibi\HeadersHelper::set('Pragma', 'public');
|
||||
\Chibi\HeadersHelper::set('Cache-Control', 'max-age=86400');
|
||||
\Chibi\HeadersHelper::set('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
|
||||
\Chibi\HeadersHelper::set('Cache-Control', 'public, max-age=' . $ttl);
|
||||
\Chibi\HeadersHelper::set('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
|
||||
|
||||
$this->context->transport->mimeType = 'image/png';
|
||||
$this->context->transport->filePath = $path;
|
||||
|
@ -741,6 +742,11 @@ class PostController
|
|||
$ext);
|
||||
$fn = preg_replace('/[[:^print:]]/', '', $fn);
|
||||
|
||||
$ttl = 60 * 60 * 24;
|
||||
\Chibi\HeadersHelper::set('Pragma', 'public');
|
||||
\Chibi\HeadersHelper::set('Cache-Control', 'public, max-age=' . $ttl);
|
||||
\Chibi\HeadersHelper::set('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
|
||||
|
||||
$this->context->transport->customFileName = $fn;
|
||||
$this->context->transport->mimeType = $post->mimeType;
|
||||
$this->context->transport->filePath = $path;
|
||||
|
|
Loading…
Reference in a new issue