Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/25' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-mabe committed Nov 29, 2015
2 parents 6c3f02d + aac3a30 commit d2cf8dd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- [#25](https://github.com/zendframework/zend-cache/pull/25)
MongoDd: fixed expiration support and removed duplicated tests
- [#40](https://github.com/zendframework/zend-cache/pull/40)
Fixed TTL support of `Redis::addItem`
- [#18](https://github.com/zendframework/zend-cache/issues/18)
Expand Down
9 changes: 2 additions & 7 deletions src/Storage/Adapter/MongoDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ protected function internalGetItem(& $normalizedKey, & $success = null, & $casTo
}

if ($result['expires']->sec < time()) {
$this->internalRemoveItem($key);

$this->internalRemoveItem($normalizedKey);
return;
}
}
Expand Down Expand Up @@ -241,12 +240,8 @@ protected function internalGetCapabilities()
'supportedMetadata' => [
'_id',
],
'minTtl' => 0,
'maxTtl' => 0,
'minTtl' => 1,
'staticTtl' => true,
'ttlPrecision' => 1,
'useRequestTime' => false,
'expiredRead' => false,
'maxKeyLength' => 255,
'namespaceIsPrefix' => true,
]
Expand Down
33 changes: 0 additions & 33 deletions test/Storage/Adapter/MongoDbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,37 +61,4 @@ public function testSetOptionsNotMongoDbOptions()

$this->assertInstanceOf('\Zend\Cache\Storage\Adapter\MongoDbOptions', $this->_storage->getOptions());
}

public function testCachedItemsExpire()
{
$ttl = 2;
$key = 'foo';
$value = 'bar';

$this->_storage->getOptions()->setTtl($ttl);

$this->_storage->setItem($key, $value);

// wait for the cached item to expire
sleep($ttl * 2);

$this->assertNull($this->_storage->getItem($key));
}

public function testFlush()
{
$key1 = 'foo';
$key2 = 'key';
$value1 = 'bar';
$value2 = 'value';

$this->assertEquals([], $this->_storage->setItems([
$key1 => $value1,
$key2 => $value2,
]));

$this->assertTrue($this->_storage->flush());

$this->assertEquals([], $this->_storage->hasItems([$key1, $key2]));
}
}

0 comments on commit d2cf8dd

Please sign in to comment.