亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Cluster cluster addslots(集群 槽位) cluster count failure reports(集群計數(shù)失敗報告) cluster countkeysinslot cluster delslots cluster failover cluster forget cluster getkeysinslot cluster info cluster keyslot(集群鍵槽) cluster meet cluster nodes(集群節(jié)點) cluster replicate(集群復(fù)制) cluster reset(集群重置) cluster saveconfig cluster set config epoch cluster setslot cluster slaves cluster slots readonly readwrite Connection auth echo ping quit select swapdb Geo geoadd geodist geohash geopos georadius georadiusbymember Hashes hdel hexists hget hgetall hincrby hincrbyfloat hkeys hlen hmget hmset hscan hset hsetnx hstrlen hvals HyperLogLog pfadd pfcount pfmerge Keys del dump exists expire expireat keys migrate move object persist pexpire pexpireat pttl randomkey rename renamenx restore scan sort touch ttl type unlink wait Lists blpop brpop brpoplpush lindex linsert llen lpop lpush lpushx lrange lrem lset ltrim rpop rpoplpush rpush rpushx Pub/Sub psubscribe publish pubsub punsubscribe subscribe unsubscribe Scripting eval evalsha script debug script exists script flush script kill script load Server bgrewriteaof bgsave client getname client kill client list client pause client reply client setname command command count command getkeys command info config get config resetstat config rewrite config set dbsize debug object debug segfault flushall flushdb info lastsave monitor role save shutdown slaveof slowlog time Sets sadd scard sdiff sdiffstore sinter sinterstore sismember smembers smove spop srandmember srem sscan sunion sunionstore Sorted Sets zadd zcard zcount zincrby zinterstore zlexcount zrange zrangebylex zrangebyscore zrank zrem zremrangebylex zremrangebyrank zremrangebyscore zrevrange zrevrangebylex zrevrangebyscore zrevrank zscan zscore zunionstore Strings append bitcount bitfield bitop bitpos decr decrby get getbit getrange getset incr incrby incrbyfloat mget mset msetnx psetex set setbit setex setnx setrange strlen Transactions discard exec multi unwatch watch
characters

BITPOS key bit [start] [end]

自2.8.7起可用。

時間復(fù)雜度: O(N)

將字符串中第一位的位置設(shè)置為1或0。

返回該位置,將字符串視為從左到右的位數(shù)組,其中第一個字節(jié)的最高有效位位于位置0,第二個字節(jié)的最高有效位位于位置8,等等。

GETBIT 和 SETBIT后面跟著相同的位位置約定。

默認情況下,檢查字符串中包含的所有字節(jié)??梢詢H在指定的時間間隔內(nèi)查找位,并傳遞額外的參數(shù) start end(可能只是傳遞start,操作會假定 end 是字符串的最后一個字節(jié),但是存在語義差異后來)。的范圍內(nèi)被解釋為范圍的字節(jié),而不是一比特的,所以start=0end=2裝置看的前三個字節(jié)。

請注意,即使在使用開始結(jié)束來指定范圍時,位位置也始終以從零位開始的絕對值的形式返回。

與 GETRANGE 命令類似,開始和結(jié)束可以包含負值,以便從字符串的末尾開始索引字節(jié),其中-1是最后一個字節(jié),-2是倒數(shù)第二個字符,等等。

不存在的鍵被視為空字符串。

返回值

整數(shù)回復(fù)

該命令根據(jù)請求返回第一位設(shè)置為1或0的位置。

如果我們查找設(shè)置位(位參數(shù)為1)并且字符串為空或僅由零字節(jié)組成,則返回-1。

如果我們查找清零位(位參數(shù)為0)并且該字符串僅包含位設(shè)為1,則函數(shù)返回第一位,而不是右側(cè)字符串的一部分。因此,如果字符串是三個字節(jié)設(shè)置為該值,0xff該命令BITPOS key 0將返回24,因為直到位23,所有的位都是1。

基本上,函數(shù)認為字符串的權(quán)利,與你尋找明確位,沒有指定范圍或補零開始的說法。

但是,如果您正在查找清除位并指定具有開始結(jié)束的范圍,則此行為會發(fā)生變化。如果在指定范圍內(nèi)未找到清除位,則該函數(shù)返回-1,因為用戶指定了一個清除范圍,并且該范圍內(nèi)沒有0位。

例子

redis>  SET mykey "\xff\xf0\x00" "OK" redis>  BITPOS mykey 0 (integer) 12 redis>  SET mykey "\x00\xff\xf0" "OK" redis>  BITPOS mykey 1 0 (integer) 8 redis>  BITPOS mykey 1 2 (integer) 16 redis>  set mykey "\x00\x00\x00" "OK" redis>  BITPOS mykey 1 (integer) -1

Previous article: Next article: