Package org.redisson.api
Interface RSet<V>
- Type Parameters:
V- type of value
- All Superinterfaces:
Collection<V>,Iterable<V>,RCollectionAsync<V>,RExpirable,RExpirableAsync,RObject,RObjectAsync,RSetAsync<V>,RSortable<Set<V>>,RSortableAsync<Set<V>>,Set<V>
- All Known Implementing Classes:
RedissonSet,RedissonSetMultimapValues,RedissonTransactionalSet
Redis based implementation of
Set- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionintaddAllCounted(Collection<? extends V> c) Adds all elements contained in the specified collection.countIntersection(int limit, String... names) Counts elements of set as a result of sets intersection with current set.countIntersection(String... names) Counts elements of set as a result of sets intersection with current set.intDiff sets specified by name and write to current set.distributedIterator(int count) Returns element iterator that can be shared across multiple applications.distributedIterator(String pattern) Returns iterator over elements that match specified pattern.distributedIterator(String iteratorName, String pattern, int count) Returns iterator over elements that match specified pattern.getCountDownLatch(V value) ReturnsRCountDownLatchinstance associated withvaluegetFairLock(V value) ReturnsRLockinstance associated withvalueReturns lock instance associated withvaluegetPermitExpirableSemaphore(V value) ReturnsRPermitExpirableSemaphoreinstance associated withvaluegetReadWriteLock(V value) ReturnsRReadWriteLockinstance associated withvaluegetSemaphore(V value) ReturnsRSemaphoreinstance associated withvalueintintersection(String... names) Intersection sets specified by name and write to current set.iterator(int count) Returns elements iterator fetches elements in a batch.Returns elements iterator.Returns elements iterator fetches elements in a batch.<KOut,VOut>
RCollectionMapReduce<V,KOut, VOut> ReturnsRMapReduceobject associated with this objectbooleanMove a member from this set to the given destination set in.random()Returns random elementrandom(int count) Returns random elements from set limited bycountreadAll()Read all elements at onceDiff sets specified by name with current set.readIntersection(String... names) Intersection sets specified by name with current set without current set state change.Union sets specified by name with current set without current set state change.intremoveAllCounted(Collection<? extends V> c) Removes all elements contained in the specified collection.Removes and returns random elementremoveRandom(int amount) Removes and returns random elements limited byamountstream(int count) Returns stream of elements fetches elements in a batch.Returns stream of elements.Returns stream of elements fetches elements in a batch.booleanTries to add elements only if none of them in set.intUnion sets specified by name and write to current set.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.redisson.api.RCollectionAsync
addAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync, sizeAsyncMethods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncMethods inherited from interface org.redisson.api.RSetAsync
addAllCountedAsync, countIntersectionAsync, countIntersectionAsync, diffAsync, intersectionAsync, moveAsync, randomAsync, randomAsync, readAllAsync, readDiffAsync, readIntersectionAsync, readUnionAsync, removeAllCountedAsync, removeRandomAsync, removeRandomAsync, tryAddAsync, unionAsyncMethods inherited from interface org.redisson.api.RSortable
readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, sortTo, sortTo, sortTo, sortTo, sortTo, sortToMethods inherited from interface org.redisson.api.RSortableAsync
readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync
-
Method Details
-
addAllCounted
Adds all elements contained in the specified collection. Returns number of added elements.- Parameters:
c- - collection of elements to add- Returns:
- number of added elements
-
removeAllCounted
Removes all elements contained in the specified collection. Returns number of removed elements.- Parameters:
c- - collection of elements to add- Returns:
- number of removed elements
-
getCountDownLatch
ReturnsRCountDownLatchinstance associated withvalue- Parameters:
value- - set value- Returns:
- RCountDownLatch object
-
getPermitExpirableSemaphore
ReturnsRPermitExpirableSemaphoreinstance associated withvalue- Parameters:
value- - set value- Returns:
- RPermitExpirableSemaphore object
-
getSemaphore
ReturnsRSemaphoreinstance associated withvalue- Parameters:
value- - set value- Returns:
- RSemaphore object
-
getFairLock
ReturnsRLockinstance associated withvalue- Parameters:
value- - set value- Returns:
- RLock object
-
getReadWriteLock
ReturnsRReadWriteLockinstance associated withvalue- Parameters:
value- - set value- Returns:
- RReadWriteLock object
-
getLock
Returns lock instance associated withvalue- Parameters:
value- - set value- Returns:
- RLock object
-
stream
Returns stream of elements fetches elements in a batch. Batch size is defined bycountparam.- Parameters:
count- - size of elements batch- Returns:
- stream of elements
-
stream
Returns stream of elements fetches elements in a batch. Batch size is defined bycountparam. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern- - search patterncount- - size of elements batch- Returns:
- stream of elements
-
stream
Returns stream of elements. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern- - search pattern- Returns:
- stream of elements
-
iterator
Returns elements iterator fetches elements in a batch. Batch size is defined bycountparam.- Parameters:
count- - size of elements batch- Returns:
- iterator
-
iterator
Returns elements iterator fetches elements in a batch. Batch size is defined bycountparam. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern- - search patterncount- - size of elements batch- Returns:
- iterator
-
iterator
Returns elements iterator. Ifpatternis not null then only elements match this pattern are loaded.- Parameters:
pattern- - search pattern- Returns:
- iterator
-
distributedIterator
Returns element iterator that can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. See distributedIterator(String, String, int) for creating different iterators.- Parameters:
count- batch size- Returns:
- shared elements iterator
-
distributedIterator
Returns iterator over elements that match specified pattern. Iterator can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. See distributedIterator(String, String, int) for creating different iterators.- Parameters:
pattern- element pattern- Returns:
- shared elements iterator
-
distributedIterator
Returns iterator over elements that match specified pattern. Iterator can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. Iterator name must be resolved to the same hash slot as set name.- Parameters:
pattern- element patterncount- batch sizeiteratorName- redis object name to which cursor will be saved- Returns:
- shared elements iterator
-
mapReduce
ReturnsRMapReduceobject associated with this object- Type Parameters:
KOut- output keyVOut- output value- Returns:
- MapReduce instance
-
removeRandom
Removes and returns random elements limited byamount- Parameters:
amount- of random elements- Returns:
- random elements
-
removeRandom
V removeRandom()Removes and returns random element- Returns:
- random element
-
random
V random()Returns random element- Returns:
- random element
-
random
Returns random elements from set limited bycount- Parameters:
count- - values amount to return- Returns:
- random elements
-
move
Move a member from this set to the given destination set in.- Parameters:
destination- the destination setmember- the member to move- Returns:
- true if the element is moved, false if the element is not a member of this set or no operation was performed
-
readAll
Read all elements at once- Returns:
- values
-
union
Union sets specified by name and write to current set. If current set already exists, it is overwritten.- Parameters:
names- - name of sets- Returns:
- size of union
-
readUnion
Union sets specified by name with current set without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
diff
Diff sets specified by name and write to current set. If current set already exists, it is overwritten.- Parameters:
names- - name of sets- Returns:
- values
-
readDiff
Diff sets specified by name with current set. Without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
intersection
Intersection sets specified by name and write to current set. If current set already exists, it is overwritten.- Parameters:
names- - name of sets- Returns:
- size of intersection
-
readIntersection
Intersection sets specified by name with current set without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
countIntersection
Counts elements of set as a result of sets intersection with current set.Requires Redis 7.0.0 and higher.
- Parameters:
names- - name of sets- Returns:
- amount of elements
-
countIntersection
Counts elements of set as a result of sets intersection with current set.Requires Redis 7.0.0 and higher.
- Parameters:
names- - name of setslimit- - sets intersection limit- Returns:
- amount of elements
-
tryAdd
Tries to add elements only if none of them in set.- Parameters:
values- - values to add- Returns:
trueif elements successfully added, otherwisefalse.
-