Unverified Commit cbea2aa0 authored by Anton Kuzmenko's avatar Anton Kuzmenko Committed by Kevin Porras
Browse files

Issue #3074189 by qzmenko, DamienMcKenna, alesr, heddn, julienjoye: [D7] Not...

Issue #3074189 by qzmenko, DamienMcKenna, alesr, heddn, julienjoye: [D7] Not compatible with php-redis 5
parent d4d00d20
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class Redis_Cache_PhpRedis extends Redis_Cache_Base

        $ret = array();

        $pipe = $client->multi(Redis::PIPELINE);
        $pipe = $client->multi();
        foreach ($idList as $id) {
            $pipe->hgetall($this->getKey($id));
        }
@@ -94,7 +94,7 @@ class Redis_Cache_PhpRedis extends Redis_Cache_Base
        $client = $this->getClient();
        $key    = $this->getKey($id);

        $pipe = $client->multi(Redis::PIPELINE);
        $pipe = $client->multi();
        $pipe->hmset($key, $data);

        if (null !== $ttl) {
@@ -112,7 +112,7 @@ class Redis_Cache_PhpRedis extends Redis_Cache_Base
    {
        $client = $this->getClient();

        $pipe = $client->multi(Redis::PIPELINE);
        $pipe = $client->multi();
        foreach ($idList as $id) {
            $pipe->del($this->getKey($id));
        }
+22 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ class Redis_Lock_PhpRedis extends Redis_Lock_DefaultBackend {

    if ($client->get($key) == $id) {
      $client->multi();
      $client->delete($key);
      $this->doDelete($client, $key);
      $client->exec();
    }
    else {
@@ -131,8 +131,28 @@ class Redis_Lock_PhpRedis extends Redis_Lock_DefaultBackend {
      $owner = $client->get($key);

      if (empty($owner) || $owner == $id) {
        $client->delete($key);
        $this->doDelete($client, $key);
      }
    }
  }

  /**
   * Wrapper for deleting items.
   *
   * This is necessary because of API changes in Redis.
   *
   * @param object $client
   *   The client object to work with.
   * @param string $key
   *   The item that needs to be deleted.
   */
  protected function doDelete($client, $key) {
    if (method_exists($client, 'del')) {
      $client->del($key);
    }
    else {
      $client->delete($key);
    }
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class Redis_Queue_PhpRedis extends Redis_Queue_Base
        $record->data = $data;
        $record->timestamp = time();

        $pipe = $client->multi(Redis::PIPELINE);
        $pipe = $client->multi();
        // Thanks to the redis_queue standalone module maintainers for
        // this piece of code, very effective. Note that we added the
        // pipeline thought.
@@ -73,7 +73,7 @@ class Redis_Queue_PhpRedis extends Redis_Queue_Base

    public function deleteItem($item)
    {
        $pipe = $this->getClient()->multi(Redis::PIPELINE);
        $pipe = $this->getClient()->multi();
        $pipe->lrem($this->getKeyForQueue(), $item->qid);
        $pipe->lrem($this->getKeyForClaimed(), $item->qid);
        $pipe->hdel($this->getKeyForData(), $item->qid);
@@ -82,7 +82,7 @@ class Redis_Queue_PhpRedis extends Redis_Queue_Base

    public function releaseItem($item)
    {
        $pipe = $this->getClient()->multi(Redis::PIPELINE);
        $pipe = $this->getClient()->multi();
        $pipe->lrem($this->getKeyForClaimed(), $item->qid, -1);
        $pipe->lpush($this->getKeyForQueue(), $item->qid);
        $ret = $pipe->exec();