Skip to content
Browse files

Merge pull request #4830. Fix #4804 in master

  • Loading branch information...
2 parents 4adfd93 + 5a5a6f1 commit 257488d371b7e2603e6409daf26a9cfe44c35975 @Maks3w Maks3w committed
View
6 library/Zend/Cache/Storage/Adapter/Redis.php
@@ -226,7 +226,7 @@ protected function internalSetItem(& $normalizedKey, & $value)
try {
if ($ttl) {
- if ($this->resourceManager->getMayorVersion($this->resourceId) < 2) {
+ if ($this->resourceManager->getMajorVersion($this->resourceId) < 2) {
throw new Exception\UnsupportedMethodCallException("To use ttl you need version >= 2.0.0");
}
$success = $redis->setex($this->namespacePrefix . $normalizedKey, $ttl, $value);
@@ -260,7 +260,7 @@ protected function internalSetItems(array & $normalizedKeyValuePairs)
try {
if ($ttl > 0) {
//check if ttl is supported
- if ($this->resourceManager->getMayorVersion($this->resourceId) < 2) {
+ if ($this->resourceManager->getMajorVersion($this->resourceId) < 2) {
throw new Exception\UnsupportedMethodCallException("To use ttl you need version >= 2.0.0");
}
//mSet does not allow ttl, so use transaction
@@ -402,7 +402,7 @@ protected function internalGetCapabilities()
{
if ($this->capabilities === null) {
$this->capabilityMarker = new stdClass();
- $minTtl = $this->resourceManager->getMayorVersion($this->resourceId) < 2 ? 0 : 1;
+ $minTtl = $this->resourceManager->getMajorVersion($this->resourceId) < 2 ? 0 : 1;
//without serialization redis supports only strings for simple
//get/set methods
$this->capabilities = new Capabilities(
View
14 library/Zend/Cache/Storage/Adapter/RedisResourceManager.php
@@ -508,12 +508,26 @@ public function getDatabase($id)
/**
* Get redis server version
*
+ * @deprecated 2.2.2 Use getMajorVersion instead
+ *
* @param string $id
* @return int
* @throws Exception\RuntimeException
*/
public function getMayorVersion($id)
{
+ return $this->getMajorVersion($id);
+ }
+
+ /**
+ * Get redis server version
+ *
+ * @param string $id
+ * @return int
+ * @throws Exception\RuntimeException
+ */
+ public function getMajorVersion($id)
+ {
if (!$this->hasResource($id)) {
throw new Exception\RuntimeException("No resource with id '{$id}'");
}
View
6 tests/ZendTest/Cache/Storage/Adapter/RedisTest.php
@@ -144,12 +144,12 @@ public function testGetCapabilitiesTtl()
$redisResource = new RedisResource();
$redisResource->connect($host, $port);
$info = $redisResource->info();
- $mayorVersion = (int)$info['redis_version'];
+ $majorVersion = (int)$info['redis_version'];
- $this->assertEquals($mayorVersion, $this->_options->getResourceManager()->getMayorVersion($this->_options->getResourceId()));
+ $this->assertEquals($majorVersion, $this->_options->getResourceManager()->getMajorVersion($this->_options->getResourceId()));
$capabilities = $this->_storage->getCapabilities();
- if ($mayorVersion < 2) {
+ if ($majorVersion < 2) {
$this->assertEquals(0, $capabilities->getMinTtl(), 'Redis version < 2.0.0 does not support key expiration');
} else {
$this->assertEquals(1, $capabilities->getMinTtl(), 'Redis version > 2.0.0 supports key expiration');

0 comments on commit 257488d

Please sign in to comment.
Something went wrong with that request. Please try again.