/** * Changes a single bit of a string. * * @param string $key * @param int $offset * @param bool $value * * @return int: 0 or 1, the value of the bit before it was set. * @link http://redis.io/commands/setbit * @example * <pre> * $redis->set('key', "*"); // ord("*") = 42 = 0x2f = "0010 1010" * $redis->setBit('key', 5, 1); // returns 0 * $redis->setBit('key', 7, 1); // returns 0 * $redis->get('key'); // chr(0x2f) = "/" = b("0010 1111") * </pre> */ public function setBit($key, $offset, $value) { try { return $this->client->setBit($key, $offset, $value); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
/** * Changes a single bit of a string. * * @param string $key * @param int $offset * @param bool $value * * @return int: 0 or 1, the value of the bit before it was set. * @link http://redis.io/commands/setbit * @example * <pre> * $redis->set('key', "*"); // ord("*") = 42 = 0x2f = "0010 1010" * $redis->setBit('key', 5, 1); // returns 0 * $redis->setBit('key', 7, 1); // returns 0 * $redis->get('key'); // chr(0x2f) = "/" = b("0010 1111") * </pre> */ public function setBit($key, $offset, $value) { $this->appendToLog('SETBIT ' . $key . ' ' . $offset . ' ' . $value); return $this->client->setBit($key, $offset, $value); }