0

On my dev system (Ubuntu 11.10) I have no problems writing my cache files to /tmp but I'm concerned about what will happen to my application when deployed. I currently have shared hosting so I'm guessing I won't have access to that directory? My app directory looks like this:

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

I created a custom folder in my applications directory called cache (as you can see above) and then used the following to configure it:

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

I used the path ../application/cache/ because everything is referenced in Zend_Framework from the index.php (i.e. front controller) located in the public folder.

When I do this, it still writes my cache to the /tmp folder. What am I missing?

Jeremy Harris
  • 24,318
  • 13
  • 79
  • 133

1 Answers1

2

I think you have a typo:

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

Not cacheDir :

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

BartekR
  • 3,827
  • 3
  • 24
  • 33
  • Thanks a lot! Looks like I was following a tutorial (http://devzone.zend.com/728/zend-framework-hidden-gems-zend_cache/) from 2006...things have changed since then! – Jeremy Harris Jan 23 '12 at 20:12