1

我有这段代码来启动Zend Cache,如果在此过程中出现错误,我设置try cache 异常以取消 Zend Cache,但它不起作用并且不会在 catch Exception 中打印错误。

$frontendOptions = array(
          'lifetime' => $cacheTime,
          'content_type_memorization' => false,
          'default_options' => array(
              'cache' => true,
              'make_id_with_cookie_variables' => false,
              'make_id_with_session_variables' => false,
              'cache_with_get_variables' => true,
              'cache_with_post_variables' => true,
              'cache_with_session_variables' => true,
              'cache_with_files_variables' => true,
              'cache_with_cookie_variables' => true,
              'tags' => $cacheTag,
          ),
          'regexps' => array(
              '$' => array('cache' => true),
          )
      );

      $backendOptions = array('cache_dir' => '/var');
      $cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);
      try {
          $cache->start();
      } catch (Exception $exc) {
          echo $exc->getMessage();
      }

我尝试了$cache->cancel()没有任何结果。

谢谢

4

0 回答 0