V - valuepublic interface RSetCache<V> extends Set<V>, RExpirable, RSetCacheAsync<V>, RDestroyable
Set-based cache with ability to set TTL for each object.
Current Redis implementation doesn't have set entry eviction functionality.
Thus values are checked for TTL expiration during any value read operation.
If entry expired then it doesn't returns and clean task runs asynchronous.
Clean task deletes removes 100 expired entries at once.
In addition there is EvictionScheduler. This scheduler
deletes expired entries in time interval between 5 seconds to 2 hours.
If eviction is not required then it's better to use RSet.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(V value,
long ttl,
TimeUnit unit)
Stores value with specified time to live.
|
RCountDownLatch |
getCountDownLatch(V value)
Returns
RCountDownLatch instance associated with value |
RLock |
getFairLock(V value)
Returns
RLock instance associated with value |
RLock |
getLock(V value)
Returns lock instance associated with
value |
RPermitExpirableSemaphore |
getPermitExpirableSemaphore(V value)
Returns
RPermitExpirableSemaphore instance associated with value |
RReadWriteLock |
getReadWriteLock(V value)
Returns
RReadWriteLock instance associated with value |
RSemaphore |
getSemaphore(V value)
Returns
RSemaphore instance associated with value |
Iterator<V> |
iterator(int count)
Returns an iterator over elements in this set.
|
Iterator<V> |
iterator(String pattern)
Returns values iterator matches
pattern. |
Iterator<V> |
iterator(String pattern,
int count)
Returns an iterator over elements in this set.
|
<KOut,VOut> |
mapReduce()
Returns
RMapReduce object associated with this map |
Set<V> |
readAll()
Read all elements at once
|
int |
size()
Returns the number of elements in cache.
|
Stream<V> |
stream(int count)
Returns stream of elements in this set.
|
Stream<V> |
stream(String pattern)
Returns stream of elements in this set matches
pattern. |
Stream<V> |
stream(String pattern,
int count)
Returns stream of elements in this set.
|
boolean |
tryAdd(long ttl,
TimeUnit unit,
V... values)
Tries to add elements only if none of them in set.
|
boolean |
tryAdd(V... values)
Tries to add elements only if none of them in set.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streamclearExpire, expire, expireAt, expireAt, remainTimeToLiveaddListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkaddAsync, readAllAsync, sizeAsync, tryAddAsync, tryAddAsyncaddAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsyncclearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsyncaddListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncdestroyRCountDownLatch getCountDownLatch(V value)
RCountDownLatch instance associated with valuevalue - - set valueRPermitExpirableSemaphore getPermitExpirableSemaphore(V value)
RPermitExpirableSemaphore instance associated with valuevalue - - set valueRSemaphore getSemaphore(V value)
RSemaphore instance associated with valuevalue - - set valueRLock getFairLock(V value)
RLock instance associated with valuevalue - - set valueRReadWriteLock getReadWriteLock(V value)
RReadWriteLock instance associated with valuevalue - - set valueRLock getLock(V value)
valuevalue - - set valueStream<V> stream(int count)
count param.count - - size of elements batchStream<V> stream(String pattern, int count)
count param.
If pattern is not null then only elements match this pattern are loaded.pattern - - search patterncount - - size of elements batchStream<V> stream(String pattern)
pattern.pattern - - search patternIterator<V> iterator(int count)
count param.count - - size of elements batchIterator<V> iterator(String pattern, int count)
count param.
If pattern is not null then only elements match this pattern are loaded.pattern - - search patterncount - - size of elements batchIterator<V> iterator(String pattern)
pattern.pattern - - search pattern<KOut,VOut> RCollectionMapReduce<V,KOut,VOut> mapReduce()
RMapReduce object associated with this mapKOut - output keyVOut - output valueboolean add(V value, long ttl, TimeUnit unit)
value - to addttl - - time to live for key\value entry.
If 0 then stores infinitely.unit - - time unittrue if value has been added. false
if value already been in collection.int size()
boolean tryAdd(V... values)
values - - values to addtrue if elements successfully added,
otherwise false.Copyright © 2014–2020 Redisson. All rights reserved.