【问题标题】:What is the preferred cache directory using Zend_Cache?使用 Zend_Cache 的首选缓存目录是什么?
【发布时间】:2012-01-23 19:33:48
【问题描述】:

在我的开发系统 (Ubuntu 11.10) 上,我将缓存文件写入 /tmp 没有问题,但我担心部署时我的应用程序会发生什么。我目前有共享主机,所以我猜我无法访问该目录?我的应用目录如下所示:

MyApp
- application
   - cache
   - configs
   - controllers
   - forms
   - layouts
   - logs
   - models
   - views
- docs
- library
- public
- tests

我在我的应用程序目录中创建了一个名为缓存的自定义文件夹(如上所示),然后使用以下内容对其进行配置:

$frontendOptions = array('lifeTime' => (strtotime('tomorrow') - time()));
$backendOptions = array('cacheDir' => '../application/cache/');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);

我使用了路径../application/cache/,因为Zend_Framework 中的所有内容都从位于public 文件夹中的index.php(即前端控制器)中引用。

当我这样做时,它仍然会将我的缓存写入/tmp 文件夹。我错过了什么?

【问题讨论】:

    标签: php zend-framework caching zend-cache


    【解决方案1】:

    我认为你有一个错字:

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

    不是cacheDir:

    http://framework.zend.com/manual/en/zend.cache.backends.html

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-14
    • 2014-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-02
    相关资源
    最近更新 更多