Package redis.clients.jedis.commands
Interface BitCommands
- All Known Subinterfaces:
JedisCommands,StringCommands
- All Known Implementing Classes:
Jedis,JedisCluster,JedisPooled,JedisSentineled,JedisSharding,UnifiedJedis
public interface BitCommands
-
Method Summary
Modifier and TypeMethodDescriptionlongBitcount Command Count the number of set bits (population counting) in a string.longBitcount Command Count the number of set bits (population counting) in a string only in an interval start and end.longbitcount(String key, long start, long end, BitCountOption option) Bitfield Command The command treats a Redis string as an array of bits, and is capable of addressing specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset.bitfieldReadonly(String key, String... arguments) The readonly version ofBITFIELDlongBitop Command Perform a bitwise operation between multiple keys (containing string values) and store the result in the destKey.longBitpos Command Return the position of the first bit set to 1 or 0 in a string.longbitpos(String key, boolean value, BitPosParams params) Bitpos Command Return the position of the first bit set to 1 or 0 in a string.booleanGetBit Command Returns the bit value at offset in the string value stored at key.booleanSetBit Command Sets or clears the bit at offset in the string value stored at key.
-
Method Details
-
setbit
SetBit Command Sets or clears the bit at offset in the string value stored at key.Time complexity: O(1)
- Parameters:
key-offset-value-- Returns:
- The original bit value stored at offset
-
getbit
GetBit Command Returns the bit value at offset in the string value stored at key.Time complexity: O(1)
- Parameters:
key-offset-- Returns:
- The bit value stored at offset
-
bitcount
Bitcount Command Count the number of set bits (population counting) in a string.- Parameters:
key-- Returns:
- The number of bits set to 1
-
bitcount
Bitcount Command Count the number of set bits (population counting) in a string only in an interval start and end.Like for the GETRANGE command start and end can contain negative values in order to index bytes starting from the end of the string, where -1 is the last byte, -2 is the penultimate, and so forth.
- Parameters:
key-start- byte start indexend- byte end index- Returns:
- The number of bits set to 1
-
bitcount
- Parameters:
key-start- byte start indexend- byte end indexoption- indicate BYTE or BIT- Returns:
- The number of bits set to 1
- See Also:
-
bitpos
Bitpos Command Return the position of the first bit set to 1 or 0 in a string.- Parameters:
key-value- the bit value- Returns:
- The position of the first bit set to 1 or 0 according to the request
-
bitpos
Bitpos Command Return the position of the first bit set to 1 or 0 in a string.- Parameters:
key-value- the bit valueparams-BitPosParams- Returns:
- The position of the first bit set to 1 or 0 according to the request
-
bitfield
Bitfield Command The command treats a Redis string as an array of bits, and is capable of addressing specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset.- Parameters:
key-arguments- may be used with optional arguments- Returns:
- A List of results
-
bitfieldReadonly
The readonly version ofBITFIELD -
bitop
Bitop Command Perform a bitwise operation between multiple keys (containing string values) and store the result in the destKey.- Parameters:
op- can be AND, OR, XOR or NOTdestKey-srcKeys-- Returns:
- The size of the string stored in the destKey
-