Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Jul 15, 2013
2 parents ca0634e + 2fe28ab commit 2d6b8b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions RedisResourceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,25 @@ 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}'");
Expand Down

0 comments on commit 2d6b8b1

Please sign in to comment.