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
public interface RSet<V> extends Set<V>, RExpirable, RSetAsync<V>, RSortable<Set<V>>
Redis based implementation ofSet- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intdiff(String... names)Diff sets specified by name and write to current set.RCountDownLatchgetCountDownLatch(V value)ReturnsRCountDownLatchinstance associated withvalueRLockgetFairLock(V value)ReturnsRLockinstance associated withvalueRLockgetLock(V value)Returns lock instance associated withvalueRPermitExpirableSemaphoregetPermitExpirableSemaphore(V value)ReturnsRPermitExpirableSemaphoreinstance associated withvalueRReadWriteLockgetReadWriteLock(V value)ReturnsRReadWriteLockinstance associated withvalueRSemaphoregetSemaphore(V value)ReturnsRSemaphoreinstance associated withvalueintintersection(String... names)Intersection sets specified by name and write to current set.Iterator<V>iterator(int count)Returns elements iterator fetches elements in a batch.Iterator<V>iterator(String pattern)Returns elements iterator.Iterator<V>iterator(String pattern, int count)Returns elements iterator fetches elements in a batch.<KOut,VOut>
RCollectionMapReduce<V,KOut,VOut>mapReduce()ReturnsRMapReduceobject associated with this objectbooleanmove(String destination, V member)Move a member from this set to the given destination set in.Vrandom()Returns random elementSet<V>random(int count)Returns random elements from set limited bycountSet<V>readAll()Read all elements at onceSet<V>readDiff(String... names)Diff sets specified by name with current set.Set<V>readIntersection(String... names)Intersection sets specified by name with current set without current set state change.Set<V>readUnion(String... names)Union sets specified by name with current set without current set state change.VremoveRandom()Removes and returns random elementSet<V>removeRandom(int amount)Removes and returns random elements limited byamountStream<V>stream(int count)Returns stream of elements fetches elements in a batch.Stream<V>stream(String pattern)Returns stream of elements.Stream<V>stream(String pattern, int count)Returns stream of elements fetches elements in a batch.booleantryAdd(V... values)Tries to add elements only if none of them in set.intunion(String... names)Union sets specified by name and write to current set.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.redisson.api.RCollectionAsync
addAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync, sizeAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods 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, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RSetAsync
diffAsync, intersectionAsync, moveAsync, randomAsync, randomAsync, readAllAsync, readDiffAsync, readIntersectionAsync, readUnionAsync, removeRandomAsync, removeRandomAsync, tryAddAsync, unionAsync
-
Methods inherited from interface org.redisson.api.RSortable
readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo
-
Methods 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 Detail
-
getCountDownLatch
RCountDownLatch getCountDownLatch(V value)
ReturnsRCountDownLatchinstance associated withvalue- Parameters:
value- - set value- Returns:
- RCountDownLatch object
-
getPermitExpirableSemaphore
RPermitExpirableSemaphore getPermitExpirableSemaphore(V value)
ReturnsRPermitExpirableSemaphoreinstance associated withvalue- Parameters:
value- - set value- Returns:
- RPermitExpirableSemaphore object
-
getSemaphore
RSemaphore getSemaphore(V value)
ReturnsRSemaphoreinstance associated withvalue- Parameters:
value- - set value- Returns:
- RSemaphore object
-
getFairLock
RLock getFairLock(V value)
ReturnsRLockinstance associated withvalue- Parameters:
value- - set value- Returns:
- RLock object
-
getReadWriteLock
RReadWriteLock getReadWriteLock(V value)
ReturnsRReadWriteLockinstance associated withvalue- Parameters:
value- - set value- Returns:
- RReadWriteLock object
-
getLock
RLock getLock(V value)
Returns lock instance associated withvalue- Parameters:
value- - set value- Returns:
- RLock object
-
stream
Stream<V> stream(int count)
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
Stream<V> stream(String pattern, int count)
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
Stream<V> stream(String pattern)
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
Iterator<V> iterator(int count)
Returns elements iterator fetches elements in a batch. Batch size is defined bycountparam.- Parameters:
count- - size of elements batch- Returns:
- iterator
-
iterator
Iterator<V> iterator(String pattern, int count)
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
Iterator<V> iterator(String pattern)
Returns elements iterator. Ifpatternis not null then only elements match this pattern are loaded.- Parameters:
pattern- - search pattern- Returns:
- iterator
-
mapReduce
<KOut,VOut> RCollectionMapReduce<V,KOut,VOut> mapReduce()
ReturnsRMapReduceobject associated with this object- Type Parameters:
KOut- output keyVOut- output value- Returns:
- MapReduce instance
-
removeRandom
Set<V> removeRandom(int amount)
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
Set<V> random(int count)
Returns random elements from set limited bycount- Parameters:
count- - values amount to return- Returns:
- random elements
-
move
boolean move(String destination, V member)
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
-
union
int union(String... names)
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
Set<V> readUnion(String... names)
Union sets specified by name with current set without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
diff
int diff(String... names)
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
Set<V> readDiff(String... names)
Diff sets specified by name with current set. Without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
intersection
int intersection(String... names)
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
Set<V> readIntersection(String... names)
Intersection sets specified by name with current set without current set state change.- Parameters:
names- - name of sets- Returns:
- values
-
tryAdd
boolean tryAdd(V... values)
Tries to add elements only if none of them in set.- Parameters:
values- - values to add- Returns:
trueif elements successfully added, otherwisefalse.
-
-