Package org.redisson
Class RedissonBitSet
- java.lang.Object
-
- org.redisson.RedissonObject
-
- org.redisson.RedissonBitSet
-
- All Implemented Interfaces:
RBitSet
,RBitSetAsync
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
public class RedissonBitSet extends RedissonObject implements RBitSet
- Author:
- Nikita Koksharov
-
-
Field Summary
-
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor
-
-
Constructor Summary
Constructors Constructor Description RedissonBitSet(CommandAsyncExecutor connectionManager, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
and(String... bitSetNames)
Executes AND operation over this object and specified bitsets.RFuture<Void>
andAsync(String... bitSetNames)
Executes AND operation over this object and specified bitsets.BitSet
asBitSet()
long
cardinality()
Returns the number of bits set to one.RFuture<Long>
cardinalityAsync()
Returns the number of bits set to one.void
clear()
Set all bits to zeroboolean
clear(long bitIndex)
Set bit to zero at specifiedbitIndex
void
clear(long fromIndex, long toIndex)
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)RFuture<Void>
clearAsync()
Set all bits to zeroRFuture<Boolean>
clearAsync(long bitIndex)
Set bit to zero at specifiedbitIndex
RFuture<Void>
clearAsync(long fromIndex, long toIndex)
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)boolean
clearExpire()
Clear an expire timeout or expire date for object.RFuture<Boolean>
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.boolean
expire(long timeToLive, TimeUnit timeUnit)
Set a timeout for object.RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit)
Set a timeout for object in async mode.boolean
expireAt(long timestamp)
Set an expire date for object.boolean
expireAt(Date timestamp)
Set an expire date for object.RFuture<Boolean>
expireAtAsync(long timestamp)
Set an expire date for object in async mode.RFuture<Boolean>
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.boolean
get(long bitIndex)
Returnstrue
if bit set to one andfalse
overwise.RFuture<Boolean>
getAsync(long bitIndex)
Returnstrue
if bit set to one andfalse
overwise.long
length()
Returns "logical size" = index of highest set bit plus one.RFuture<Long>
lengthAsync()
Returns "logical size" = index of highest set bit plus one.void
not()
Executes NOT operation over all bitsRFuture<Void>
notAsync()
Executes NOT operation over all bitsvoid
or(String... bitSetNames)
Executes OR operation over this object and specified bitsets.RFuture<Void>
orAsync(String... bitSetNames)
Executes OR operation over this object and specified bitsets.long
remainTimeToLive()
Remaining time to live of Redisson object that has a timeoutRFuture<Long>
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeoutboolean
set(long bitIndex)
Set bit to one at specified bitIndexvoid
set(long bitIndex, boolean value)
Set bit tovalue
at specifiedbitIndex
void
set(long fromIndex, long toIndex)
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)void
set(long fromIndex, long toIndex, boolean value)
Set all bits tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)void
set(BitSet bs)
Copy bits state of source BitSet object to this objectRFuture<Boolean>
setAsync(long bitIndex)
Set bit to one at specified bitIndexRFuture<Boolean>
setAsync(long bitIndex, boolean value)
Set bit tovalue
at specifiedbitIndex
RFuture<Void>
setAsync(long fromIndex, long toIndex)
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)RFuture<Void>
setAsync(long fromIndex, long toIndex, boolean value)
Set all bits tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)RFuture<Void>
setAsync(BitSet bs)
Copy bits state of source BitSet object to this objectlong
size()
Returns number of set bits.RFuture<Long>
sizeAsync()
Returns number of set bits.byte[]
toByteArray()
RFuture<byte[]>
toByteArrayAsync()
String
toString()
void
xor(String... bitSetNames)
Executes XOR operation over this object and specified bitsets.RFuture<Void>
xorAsync(String... bitSetNames)
Executes XOR operation over this object and specified bitsets.-
Methods inherited from class org.redisson.RedissonObject
await, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, suffixName, toSeconds, touch, touchAsync, unlink, unlinkAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
-
-
-
Constructor Detail
-
RedissonBitSet
public RedissonBitSet(CommandAsyncExecutor connectionManager, String name)
-
-
Method Detail
-
length
public long length()
Description copied from interface:RBitSet
Returns "logical size" = index of highest set bit plus one. Returns zero if there are no any set bit.
-
set
public void set(BitSet bs)
Description copied from interface:RBitSet
Copy bits state of source BitSet object to this object
-
get
public boolean get(long bitIndex)
Description copied from interface:RBitSet
Returnstrue
if bit set to one andfalse
overwise.
-
getAsync
public RFuture<Boolean> getAsync(long bitIndex)
Description copied from interface:RBitSetAsync
Returnstrue
if bit set to one andfalse
overwise.- Specified by:
getAsync
in interfaceRBitSetAsync
- Parameters:
bitIndex
- - index of bit- Returns:
true
if bit set to one andfalse
overwise.
-
set
public boolean set(long bitIndex)
Description copied from interface:RBitSet
Set bit to one at specified bitIndex
-
set
public void set(long fromIndex, long toIndex, boolean value)
Description copied from interface:RBitSet
Set all bits tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)
-
set
public void set(long fromIndex, long toIndex)
Description copied from interface:RBitSet
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)
-
set
public void set(long bitIndex, boolean value)
Description copied from interface:RBitSet
Set bit tovalue
at specifiedbitIndex
-
setAsync
public RFuture<Boolean> setAsync(long bitIndex, boolean value)
Description copied from interface:RBitSetAsync
Set bit tovalue
at specifiedbitIndex
- Specified by:
setAsync
in interfaceRBitSetAsync
- Parameters:
bitIndex
- - index of bitvalue
- true = 1, false = 0- Returns:
true
- if previous value was true,false
- if previous value was false
-
toByteArray
public byte[] toByteArray()
- Specified by:
toByteArray
in interfaceRBitSet
-
toByteArrayAsync
public RFuture<byte[]> toByteArrayAsync()
- Specified by:
toByteArrayAsync
in interfaceRBitSetAsync
-
cardinality
public long cardinality()
Description copied from interface:RBitSet
Returns the number of bits set to one.- Specified by:
cardinality
in interfaceRBitSet
- Returns:
- number of bits
-
size
public long size()
Description copied from interface:RBitSet
Returns number of set bits.
-
clear
public void clear(long fromIndex, long toIndex)
Description copied from interface:RBitSet
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)
-
clear
public boolean clear(long bitIndex)
Description copied from interface:RBitSet
Set bit to zero at specifiedbitIndex
-
clear
public void clear()
Description copied from interface:RBitSet
Set all bits to zero
-
or
public void or(String... bitSetNames)
Description copied from interface:RBitSet
Executes OR operation over this object and specified bitsets. Stores result into this object.
-
and
public void and(String... bitSetNames)
Description copied from interface:RBitSet
Executes AND operation over this object and specified bitsets. Stores result into this object.
-
xor
public void xor(String... bitSetNames)
Description copied from interface:RBitSet
Executes XOR operation over this object and specified bitsets. Stores result into this object.
-
not
public void not()
Description copied from interface:RBitSet
Executes NOT operation over all bits
-
lengthAsync
public RFuture<Long> lengthAsync()
Description copied from interface:RBitSetAsync
Returns "logical size" = index of highest set bit plus one. Returns zero if there are no any set bit.- Specified by:
lengthAsync
in interfaceRBitSetAsync
- Returns:
- "logical size" = index of highest set bit plus one
-
setAsync
public RFuture<Void> setAsync(long fromIndex, long toIndex, boolean value)
Description copied from interface:RBitSetAsync
Set all bits tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)- Specified by:
setAsync
in interfaceRBitSetAsync
- Parameters:
fromIndex
- inclusivetoIndex
- exclusivevalue
- true = 1, false = 0- Returns:
- void
-
clearAsync
public RFuture<Void> clearAsync(long fromIndex, long toIndex)
Description copied from interface:RBitSetAsync
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)- Specified by:
clearAsync
in interfaceRBitSetAsync
- Parameters:
fromIndex
- inclusivetoIndex
- exclusive- Returns:
- void
-
setAsync
public RFuture<Void> setAsync(BitSet bs)
Description copied from interface:RBitSetAsync
Copy bits state of source BitSet object to this object- Specified by:
setAsync
in interfaceRBitSetAsync
- Parameters:
bs
- - BitSet source- Returns:
- void
-
notAsync
public RFuture<Void> notAsync()
Description copied from interface:RBitSetAsync
Executes NOT operation over all bits- Specified by:
notAsync
in interfaceRBitSetAsync
- Returns:
- void
-
setAsync
public RFuture<Void> setAsync(long fromIndex, long toIndex)
Description copied from interface:RBitSetAsync
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)- Specified by:
setAsync
in interfaceRBitSetAsync
- Parameters:
fromIndex
- inclusivetoIndex
- exclusive- Returns:
- void
-
sizeAsync
public RFuture<Long> sizeAsync()
Description copied from interface:RBitSetAsync
Returns number of set bits.- Specified by:
sizeAsync
in interfaceRBitSetAsync
- Returns:
- number of set bits.
-
setAsync
public RFuture<Boolean> setAsync(long bitIndex)
Description copied from interface:RBitSetAsync
Set bit to one at specified bitIndex- Specified by:
setAsync
in interfaceRBitSetAsync
- Parameters:
bitIndex
- - index of bit- Returns:
true
- if previous value was true,false
- if previous value was false
-
cardinalityAsync
public RFuture<Long> cardinalityAsync()
Description copied from interface:RBitSetAsync
Returns the number of bits set to one.- Specified by:
cardinalityAsync
in interfaceRBitSetAsync
- Returns:
- number of bits
-
clearAsync
public RFuture<Boolean> clearAsync(long bitIndex)
Description copied from interface:RBitSetAsync
Set bit to zero at specifiedbitIndex
- Specified by:
clearAsync
in interfaceRBitSetAsync
- Parameters:
bitIndex
- - index of bit- Returns:
true
- if previous value was true,false
- if previous value was false
-
clearAsync
public RFuture<Void> clearAsync()
Description copied from interface:RBitSetAsync
Set all bits to zero- Specified by:
clearAsync
in interfaceRBitSetAsync
- Returns:
- void
-
orAsync
public RFuture<Void> orAsync(String... bitSetNames)
Description copied from interface:RBitSetAsync
Executes OR operation over this object and specified bitsets. Stores result into this object.- Specified by:
orAsync
in interfaceRBitSetAsync
- Parameters:
bitSetNames
- - name of stored bitsets- Returns:
- void
-
andAsync
public RFuture<Void> andAsync(String... bitSetNames)
Description copied from interface:RBitSetAsync
Executes AND operation over this object and specified bitsets. Stores result into this object.- Specified by:
andAsync
in interfaceRBitSetAsync
- Parameters:
bitSetNames
- - name of stored bitsets- Returns:
- void
-
xorAsync
public RFuture<Void> xorAsync(String... bitSetNames)
Description copied from interface:RBitSetAsync
Executes XOR operation over this object and specified bitsets. Stores result into this object.- Specified by:
xorAsync
in interfaceRBitSetAsync
- Parameters:
bitSetNames
- - name of stored bitsets- Returns:
- void
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirable
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsync
Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in interfaceRExpirable
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
public RFuture<Long> remainTimeToLiveAsync()
Description copied from interface:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
-