Interface BitmapBaseCommands

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key, long start)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key, long start, long end)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key, long start, long end, BitmapIndexType options)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key, long start)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key, long start, long end)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key, long start, long end, BitmapIndexType options)
      Counts the number of set bits (population counting) in a string stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfield​(GlideString key, BitFieldOptions.BitFieldSubCommands[] subCommands)
      Reads or modifies the array of bits representing the string that is held at key based on the specified subCommands.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfield​(java.lang.String key, BitFieldOptions.BitFieldSubCommands[] subCommands)
      Reads or modifies the array of bits representing the string that is held at key based on the specified subCommands.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfieldReadOnly​(GlideString key, BitFieldOptions.BitFieldReadOnlySubCommands[] subCommands)
      Reads the array of bits representing the string that is held at key based on the specified subCommands.
      This command is routed depending on the client's ReadFrom strategy.
      java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfieldReadOnly​(java.lang.String key, BitFieldOptions.BitFieldReadOnlySubCommands[] subCommands)
      Reads the array of bits representing the string that is held at key based on the specified subCommands.
      This command is routed depending on the client's ReadFrom strategy.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitop​(BitwiseOperation bitwiseOperation, GlideString destination, GlideString[] keys)
      Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitop​(BitwiseOperation bitwiseOperation, java.lang.String destination, java.lang.String[] keys)
      Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key, long bit)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key, long bit, long start)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key, long bit, long start, long end)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key, long bit, long start, long end, BitmapIndexType offsetType)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key, long bit)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key, long bit, long start)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key, long bit, long start, long end)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key, long bit, long start, long end, BitmapIndexType offsetType)
      Returns the position of the first bit matching the given bit value.
      java.util.concurrent.CompletableFuture<java.lang.Long> getbit​(GlideString key, long offset)
      Returns the bit value at offset in the string value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> getbit​(java.lang.String key, long offset)
      Returns the bit value at offset in the string value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> setbit​(GlideString key, long offset, long value)
      Sets or clears the bit at offset in the string value stored at key.
      java.util.concurrent.CompletableFuture<java.lang.Long> setbit​(java.lang.String key, long offset, long value)
      Sets or clears the bit at offset in the string value stored at key.
    • Method Detail

      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key)
        Counts the number of set bits (population counting) in a string stored at key.
        Parameters:
        key - The key for the string to count the set bits of.
        Returns:
        The number of set bits in the string. Returns zero if the key is missing as it is treated as an empty string.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount("myKey1").get();
         assert payload == 2L; // The string stored at "myKey1" contains 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key)
        Counts the number of set bits (population counting) in a string stored at key.
        Parameters:
        key - The key for the string to count the set bits of.
        Returns:
        The number of set bits in the string. Returns zero if the key is missing as it is treated as an empty string.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount(gs("myKey1")).get();
         assert payload == 2L; // The string stored at "myKey1" contains 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key,
                                                                        long start)
        Counts the number of set bits (population counting) in a string stored at key. The offset start is a zero-based index, with 0 being the first byte of the list, 1 being the next byte and so on. This offset can also be a negative number indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset byte index.
        Returns:
        The number of set bits in the string byte interval specified by start to the last byte. Returns zero if the key is missing as it is treated as an empty string.
        Since:
        Valkey 8.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount("myKey1", 1).get();
         assert payload == 2L; // From the second to the last bytes of the string stored at "myKey1" are 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key,
                                                                        long start)
        Counts the number of set bits (population counting) in a string stored at key. The offset start is a zero-based index, with 0 being the first byte of the list, 1 being the next byte and so on. This offset can also be a negative number indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset byte index.
        Returns:
        The number of set bits in the string byte interval specified by start to the last byte. Returns zero if the key is missing as it is treated as an empty string.
        Since:
        Valkey 8.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount(gs("myKey1"), 1).get();
         assert payload == 2L; // From the second to the last bytes of the string stored at "myKey1" are 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key,
                                                                        long start,
                                                                        long end)
        Counts the number of set bits (population counting) in a string stored at key. The offsets start and end are zero-based indexes, with 0 being the first element of the list, 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset byte index.
        end - The ending offset byte index.
        Returns:
        The number of set bits in the string byte interval specified by start and end. Returns zero if the key is missing as it is treated as an empty string.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount("myKey1", 1, 3).get();
         assert payload == 2L; // The second to fourth bytes of the string stored at "myKey1" contains 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key,
                                                                        long start,
                                                                        long end)
        Counts the number of set bits (population counting) in a string stored at key. The offsets start and end are zero-based indexes, with 0 being the first element of the list, 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset byte index.
        end - The ending offset byte index.
        Returns:
        The number of set bits in the string byte interval specified by start and end. Returns zero if the key is missing as it is treated as an empty string.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount(gs("myKey1"), 1, 3).get();
         assert payload == 2L; // The second to fourth bytes of the string stored at "myKey1" contains 2 set bits.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(java.lang.String key,
                                                                        long start,
                                                                        long end,
                                                                        BitmapIndexType options)
        Counts the number of set bits (population counting) in a string stored at key. The offsets start and end are zero-based indexes, with 0 being the first element of the list, 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset.
        end - The ending offset.
        options - The index offset type. Could be either BitmapIndexType.BIT or BitmapIndexType.BYTE.
        Returns:
        The number of set bits in the string interval specified by start, end, and options. Returns zero if the key is missing as it is treated as an empty string.
        Since:
        Valkey 7.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount("myKey1", 1, 1, BIT).get();
         assert payload == 1L; // Indicates that the second bit of the string stored at "myKey1" is set.
         
      • bitcount

        java.util.concurrent.CompletableFuture<java.lang.Long> bitcount​(GlideString key,
                                                                        long start,
                                                                        long end,
                                                                        BitmapIndexType options)
        Counts the number of set bits (population counting) in a string stored at key. The offsets start and end are zero-based indexes, with 0 being the first element of the list, 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key for the string to count the set bits of.
        start - The starting offset.
        end - The ending offset.
        options - The index offset type. Could be either BitmapIndexType.BIT or BitmapIndexType.BYTE.
        Returns:
        The number of set bits in the string interval specified by start, end, and options. Returns zero if the key is missing as it is treated as an empty string.
        Since:
        Valkey 7.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitcount(gs("myKey1"), 1, 1, BIT).get();
         assert payload == 1L; // Indicates that the second bit of the string stored at "myKey1" is set.
         
      • setbit

        java.util.concurrent.CompletableFuture<java.lang.Long> setbit​(java.lang.String key,
                                                                      long offset,
                                                                      long value)
        Sets or clears the bit at offset in the string value stored at key. The offset is a zero-based index, with 0 being the first element of the list, 1 being the next element, and so on. The offset must be less than 2^32 and greater than or equal to 0. If a key is non-existent then the bit at offset is set to value and the preceding bits are set to 0.
        Parameters:
        key - The key of the string.
        offset - The index of the bit to be set.
        value - The bit value to set at offset. The value must be 0 or 1.
        Returns:
        The bit value that was previously stored at offset.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.setbit("myKey1", 1, 1).get();
         assert payload == 0L; // The second bit value was 0 before setting to 1.
         
      • setbit

        java.util.concurrent.CompletableFuture<java.lang.Long> setbit​(GlideString key,
                                                                      long offset,
                                                                      long value)
        Sets or clears the bit at offset in the string value stored at key. The offset is a zero-based index, with 0 being the first element of the list, 1 being the next element, and so on. The offset must be less than 2^32 and greater than or equal to 0. If a key is non-existent then the bit at offset is set to value and the preceding bits are set to 0.
        Parameters:
        key - The key of the string.
        offset - The index of the bit to be set.
        value - The bit value to set at offset. The value must be 0 or 1.
        Returns:
        The bit value that was previously stored at offset.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.setbit(gs("myKey1"), 1, 1).get();
         assert payload == 0L; // The second bit value was 0 before setting to 1.
         
      • getbit

        java.util.concurrent.CompletableFuture<java.lang.Long> getbit​(java.lang.String key,
                                                                      long offset)
        Returns the bit value at offset in the string value stored at key. offset should be greater than or equal to zero.
        Parameters:
        key - The key of the string.
        offset - The index of the bit to return.
        Returns:
        The bit at offset of the string. Returns zero if the key is empty or if the positive offset exceeds the length of the string.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("sampleKey", "A"); // "A" has binary value 01000001
         Long payload = client.getbit("sampleKey", 1).get();
         assert payload == 1L; // The second bit for string stored at "sampleKey" is set to 1.
         
      • getbit

        java.util.concurrent.CompletableFuture<java.lang.Long> getbit​(GlideString key,
                                                                      long offset)
        Returns the bit value at offset in the string value stored at key. offset should be greater than or equal to zero.
        Parameters:
        key - The key of the string.
        offset - The index of the bit to return.
        Returns:
        The bit at offset of the string. Returns zero if the key is empty or if the positive offset exceeds the length of the string.
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("sampleKey"), gs("A")); // "A" has binary value 01000001
         Long payload = client.getbit(gs("sampleKey"), 1).get();
         assert payload == 1L; // The second bit for string stored at "sampleKey" is set to 1.
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key,
                                                                      long bit)
        Returns the position of the first bit matching the given bit value.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        Returns:
        The position of the first occurrence matching bit in the binary value of the string held at key. If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos("myKey1", 0).get();
         // Indicates that the first occurrence of a 0 bit value is the fourth bit of the binary value
         // of the string stored at "myKey1".
         assert payload == 3L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key,
                                                                      long bit)
        Returns the position of the first bit matching the given bit value.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        Returns:
        The position of the first occurrence matching bit in the binary value of the string held at key. If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos(gs("myKey1"), 0).get();
         // Indicates that the first occurrence of a 0 bit value is the fourth bit of the binary value
         // of the string stored at "myKey1".
         assert payload == 3L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key,
                                                                      long bit,
                                                                      long start)
        Returns the position of the first bit matching the given bit value. The offset start is a zero-based index, with 0 being the first byte of the list, 1 being the next byte and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        Returns:
        The position of the first occurrence beginning at the start offset of the bit in the binary value of the string held at key. If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos("myKey1", 1, 4).get();
         // Indicates that the first occurrence of a 1 bit value starting from fifth byte is the 34th
         // bit of the binary value of the string stored at "myKey1".
         assert payload == 33L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key,
                                                                      long bit,
                                                                      long start)
        Returns the position of the first bit matching the given bit value. The offset start is a zero-based index, with 0 being the first byte of the list, 1 being the next byte and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        Returns:
        The position of the first occurrence beginning at the start offset of the bit in the binary value of the string held at key. If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos(gs("myKey1"), 1, 4).get();
         // Indicates that the first occurrence of a 1 bit value starting from fifth byte is the 34th
         // bit of the binary value of the string stored at "myKey1".
         assert payload == 33L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key,
                                                                      long bit,
                                                                      long start,
                                                                      long end)
        Returns the position of the first bit matching the given bit value. The offsets start and end are zero-based indexes, with 0 being the first byte of the list, 1 being the next byte and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        end - The ending offset.
        Returns:
        The position of the first occurrence from the start to the end offsets of the bit in the binary value of the string held at key . If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos("myKey1", 1, 4, 6).get();
         // Indicates that the first occurrence of a 1 bit value starting from the fifth to seventh
         // bytes is the 34th bit of the binary value of the string stored at "myKey1".
         assert payload == 33L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key,
                                                                      long bit,
                                                                      long start,
                                                                      long end)
        Returns the position of the first bit matching the given bit value. The offsets start and end are zero-based indexes, with 0 being the first byte of the list, 1 being the next byte and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last byte of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        end - The ending offset.
        Returns:
        The position of the first occurrence from the start to the end offsets of the bit in the binary value of the string held at key . If bit is not found, a -1 is returned.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos(gs("myKey1"), 1, 4, 6).get();
         // Indicates that the first occurrence of a 1 bit value starting from the fifth to seventh
         // bytes is the 34th bit of the binary value of the string stored at "myKey1".
         assert payload == 33L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(java.lang.String key,
                                                                      long bit,
                                                                      long start,
                                                                      long end,
                                                                      BitmapIndexType offsetType)
        Returns the position of the first bit matching the given bit value. The offset offsetType specifies whether the offset is a BIT or BYTE. If BIT is specified, start==0 and end==2 means to look at the first three bits. If BYTE is specified, start==0 and end==2 means to look at the first three bytes The offsets are zero-based indexes, with 0 being the first element of the list, 1 being the next, and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        end - The ending offset.
        offsetType - The index offset type. Could be either BitmapIndexType.BIT or BitmapIndexType.BYTE.
        Returns:
        The position of the first occurrence from the start to the end offsets of the bit in the binary value of the string held at key . If bit is not found, a -1 is returned.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos("myKey1", 1, 4, 6, BIT).get();
         // Indicates that the first occurrence of a 1 bit value starting from the fifth to seventh
         // bits is the sixth bit of the binary value of the string stored at "myKey1".
         assert payload == 5L;
         
      • bitpos

        java.util.concurrent.CompletableFuture<java.lang.Long> bitpos​(GlideString key,
                                                                      long bit,
                                                                      long start,
                                                                      long end,
                                                                      BitmapIndexType offsetType)
        Returns the position of the first bit matching the given bit value. The offset offsetType specifies whether the offset is a BIT or BYTE. If BIT is specified, start==0 and end==2 means to look at the first three bits. If BYTE is specified, start==0 and end==2 means to look at the first three bytes The offsets are zero-based indexes, with 0 being the first element of the list, 1 being the next, and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last element of the list, -2 being the penultimate, and so on.
        Parameters:
        key - The key of the string.
        bit - The bit value to match. The value must be 0 or 1.
        start - The starting offset.
        end - The ending offset.
        offsetType - The index offset type. Could be either BitmapIndexType.BIT or BitmapIndexType.BYTE.
        Returns:
        The position of the first occurrence from the start to the end offsets of the bit in the binary value of the string held at key . If bit is not found, a -1 is returned.
        Since:
        Valkey 7.0 and above.
        See Also:
        valkey.io for details.
        Example:
        
         Long payload = client.bitpos(gs("myKey1"), 1, 4, 6, BIT).get();
         // Indicates that the first occurrence of a 1 bit value starting from the fifth to seventh
         // bits is the sixth bit of the binary value of the string stored at "myKey1".
         assert payload == 5L;
         
      • bitop

        java.util.concurrent.CompletableFuture<java.lang.Long> bitop​(BitwiseOperation bitwiseOperation,
                                                                     java.lang.String destination,
                                                                     java.lang.String[] keys)
        Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination.
        Parameters:
        bitwiseOperation - The bitwise operation to perform.
        destination - The key that will store the resulting string.
        keys - The list of keys to perform the bitwise operation on.
        Returns:
        The size of the string stored in destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("key1", "A"); // "A" has binary value 01000001
         client.set("key2", "B"); // "B" has binary value 01000010
         Long payload = client.bitop(BitwiseOperation.AND, "destination", new String[] {key1, key2}).get();
         assert "@".equals(client.get("destination").get()); // "@" has binary value 01000000
         assert payload == 1L; // The size of the resulting string is 1.
         
      • bitop

        java.util.concurrent.CompletableFuture<java.lang.Long> bitop​(BitwiseOperation bitwiseOperation,
                                                                     GlideString destination,
                                                                     GlideString[] keys)
        Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination.
        Parameters:
        bitwiseOperation - The bitwise operation to perform.
        destination - The key that will store the resulting string.
        keys - The list of keys to perform the bitwise operation on.
        Returns:
        The size of the string stored in destination.
        See Also:
        valkey.io for details.
        Example:
        
         client.set("key1", "A"); // "A" has binary value 01000001
         client.set("key2", "B"); // "B" has binary value 01000010
         Long payload = client.bitop(BitwiseOperation.AND, gs("destination"), new GlideString[] {key1, key2}).get();
         assert "@".equals(client.get("destination").get()); // "@" has binary value 01000000
         assert payload == 1L; // The size of the resulting string is 1.
         
      • bitfieldReadOnly

        java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfieldReadOnly​(java.lang.String key,
                                                                                  BitFieldOptions.BitFieldReadOnlySubCommands[] subCommands)
        Reads the array of bits representing the string that is held at key based on the specified subCommands.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the string.
        subCommands - The GET subCommands to be performed.
        Returns:
        An array of results from the GET subcommands.
        Since:
        Valkey 6.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         client.set("sampleKey", "A"); // "A" has binary value 01000001
         Long[] payload =
              client.
                  bitfieldReadOnly(
                      "sampleKey",
                      new BitFieldReadOnlySubCommands[] {
                          new BitFieldGet(new UnsignedEncoding(2), new Offset(1))
                      })
                  .get();
         assertArrayEquals(payload, new Long[] {2L}); // Value is from 0(10)00001
         
      • bitfieldReadOnly

        java.util.concurrent.CompletableFuture<java.lang.Long[]> bitfieldReadOnly​(GlideString key,
                                                                                  BitFieldOptions.BitFieldReadOnlySubCommands[] subCommands)
        Reads the array of bits representing the string that is held at key based on the specified subCommands.
        This command is routed depending on the client's ReadFrom strategy.
        Parameters:
        key - The key of the string.
        subCommands - The GET subCommands to be performed.
        Returns:
        An array of results from the GET subcommands.
        Since:
        Valkey 6.0 and above
        See Also:
        valkey.io for details.
        Example:
        
         client.set(gs("sampleKey"), gs("A")); //string "A" has binary value 01000001
         Long[] payload =
              client.
                  bitfieldReadOnly(
                      gs("sampleKey"),
                      new BitFieldReadOnlySubCommands[] {
                          new BitFieldGet(new UnsignedEncoding(2), new Offset(1))
                      })
                  .get();
         assertArrayEquals(payload, new Long[] {2L}); // Value is from 0(10)00001