/** * Renames a key. * * @param string $srcKey * @param string $dstKey * * @return bool: TRUE in case of success, FALSE in case of failure. * @link http://redis.io/commands/rename * @example * <pre> * $redis->set('x', '42'); * $redis->rename('x', 'y'); * $redis->get('y'); // → 42 * $redis->get('x'); // → `FALSE` * </pre> */ public function rename($srcKey, $dstKey) { try { return $this->client->rename($srcKey, $dstKey); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
/** * {@inheritdoc} */ public function rename($srcKey, $dstKey) { unset($this->cache[$srcKey]); unset($this->cache[$dstKey]); return $this->redis->rename($srcKey, $dstKey); }
/** * Renames a key. * * @param string $srcKey * @param string $dstKey * @throws IdenticalSourceDestinationException * * @return bool: TRUE in case of success, FALSE in case of failure. * @link http://redis.io/commands/rename * @example * <pre> * $redis->set('x', '42'); * $redis->rename('x', 'y'); * $redis->get('y'); // → 42 * $redis->get('x'); // → `FALSE` * </pre> */ public function rename($srcKey, $dstKey) { $this->appendToLog('RENAME ' . $srcKey . ' ' . $dstKey); return $this->client->rename($srcKey, $dstKey); }
public function testNoSuchKeyException() { $this->setExpectedException(NoSuchKeyException::class); $this->redis->del('testRename'); $this->redis->rename('testRename', 'testRenameNew'); }