mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
fixing File cache engine expire #3006
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5492 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c84bbea48b
commit
020841b989
2 changed files with 10 additions and 3 deletions
|
@ -143,7 +143,7 @@ class Cache extends Object {
|
|||
if (is_resource($value)) {
|
||||
return false;
|
||||
}
|
||||
$duration = ife(is_string($duration), strtotime($duration), intval($duration));
|
||||
$duration = ife(is_string($duration), strtotime($duration) - time(), intval($duration));
|
||||
if ($duration < 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
11
cake/tests/cases/libs/cache/file.test.php
vendored
11
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -66,14 +66,21 @@ class FileEngineTest extends UnitTestCase {
|
|||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data, "+1 second");
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('test', $data);
|
||||
$result = Cache::write('delete_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::delete('test');
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue