Skip to content

Commit

Permalink
Updating doc block for FileEngine.
Browse files Browse the repository at this point in the history
Fixing Cache::set() so strtotime compatible durations are handled properly.
Restoring previous change in Xcache test case.
  • Loading branch information
markstory committed Nov 21, 2009
1 parent fb7d99e commit d37dd4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions cake/libs/cache.php
Expand Up @@ -234,6 +234,9 @@ function set($settings = array(), $value = null) {
$settings = array($settings => $value);
}
$settings = array_merge($self->__config[$self->__name], $settings);
if (isset($settings['duration']) && !is_numeric($settings['duration'])) {
$settings['duration'] = strtotime($settings['duration']) - time();
}
}
$self->_engines[$name]->settings = $settings;
}
Expand Down
11 changes: 6 additions & 5 deletions cake/libs/cache/file.php
Expand Up @@ -37,11 +37,12 @@ class FileEngine extends CacheEngine {
var $__File = null;

/**
* settings
* path = absolute path to cache directory, default => CACHE
* prefix = string prefix for filename, default => cake_
* lock = enable file locking on write, default => false
* serialize = serialize the data, default => true
* Settings
*
* - path = absolute path to cache directory, default => CACHE
* - prefix = string prefix for filename, default => cake_
* - lock = enable file locking on write, default => false
* - serialize = serialize the data, default => true
*
* @var array
* @see CacheEngine::__defaults
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/cache/xcache.test.php
Expand Up @@ -132,7 +132,7 @@ function testExpiry() {
$result = Cache::read('other_test');
$this->assertFalse($result);

Cache::set(array('duration' => 1));
Cache::set(array('duration' => "+1 second"));

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('other_test', $data);
Expand Down

0 comments on commit d37dd4c

Please sign in to comment.