当我尝试缓存私有图像(带有修改标题的动作)时,标题被省略

我有以下行动:
public function viewImageAction()
{
    $this->_helper->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender();

    $filename = sanitize_filename($this->_request->getParam('file'), 'jpg');
    $data = file_get_contents(APPLICATION_PATH . '/../private-files/fans-pictures/' . $filename);
    $this->getResponse()
         ->setHeader('Content-type', 'image/jpeg')
         ->setBody($data);
}
在应用程序启动之前的index.php中,我有:
/** Zend Cache to avoid unecessary application load **/
require_once 'Zend/Cache.php';

$frontendOptions = array(
'lifetime' => 3600,
'default_options' => array(
    'cache' => $cache_flag,
    'cache_with_cookie_variables' => true,
    'make_id_with_cookie_variables' => false),
'regexps' => array(
    '^(/.+)?/admin/?' => array('cache' => false),
    '^(/.+)?/pictures/view-image/?' => array('cache' => true),
    '^(/.+)?/authentication/?' => array('cache' => false),
    '^(/.+)?/fan-profile/?' => array('cache' => false),
    '^(/.+)?/fan-registration/?' => array('cache' => false))
);

$backendOptions = array(
'cache_dir' => APPLICATION_PATH . '/cache/pages/');

$cache = Zend_Cache::factory(
  'Page', 'File', $frontendOptions, $backendOptions
);

$cache->start();
缓存工作正常,除非我尝试访问网址,如
public/admin/pictures/view-image/file/63.jpg
,标题附带
text/html
而不是
image/jpeg
。 难道我做错了什么? EDITED 我试过了:
'memorize_headers' => array('Content-type')
但没什么...... 此外,我注意到这种类型的缓存(在应用程序启动之前)无法在管理区域上完​​成,因为应用程序需要运行并检查会话。所以我需要尽快放置chache以避免所有组件的负载。 有小费吗?     
已邀请:
解 问题在于
memorize_headers
参数的位置。 我在尝试这个:
$frontendOptions = array(
'lifetime' => 3600,
'default_options' => array(
    'cache' => $cache_flag,
    'cache_with_cookie_variables' => true,
    'memorize_headers' => array('Content-Type', 'Content-Encoding'),
    'make_id_with_cookie_variables' => false),
'regexps' => array(
    '^(/.+)?/admin/?' => array('cache' => false),
    '^(/.+)?/admin/pictures/view-image/?' => array('cache' => true),
    '^(/.+)?/authentication/?' => array('cache' => false),
    '^(/.+)?/fan-profile/?' => array('cache' => false),
    '^(/.+)?/fan-registration/?' => array('cache' => false))
);
正确的位置是
default_options
键:
$frontendOptions = array(
'lifetime' => 3600,
'memorize_headers' => array('Content-Type', 'Content-Encoding'),
'default_options' => array(
    'cache' => $cache_flag,
    'cache_with_cookie_variables' => true,
    //'cache_with_session_variables' => true,
    'make_id_with_cookie_variables' => false),
'regexps' => array(
    '^(/.+)?/admin/?' => array('cache' => false),
    '^(/.+)?/admin/pictures/view-image/?' => array('cache' => true),
    '^(/.+)?/authentication/?' => array('cache' => false),
    '^(/.+)?/fan-profile/?' => array('cache' => false),
    '^(/.+)?/fan-registration/?' => array('cache' => false))
);
现在它有效。     

要回复问题请先登录注册