K
- keyV
- valuepublic interface RSetCache<V> extends Set<V>, RExpirable, RSetCacheAsync<V>
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 org.redisson.reactive.RedissonSet
.
Modifier and Type | Method and Description |
---|---|
boolean |
add(V value,
long ttl,
TimeUnit unit)
Stores value with specified time to live.
|
Set<V> |
readAll()
Read all elements at once
|
int |
size()
Returns the number of elements in cache.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
clearExpire, expire, expireAt, expireAt, remainTimeToLive
delete, getName, isExists, migrate, move, rename, renamenx
addAsync, readAllAsync, sizeAsync
addAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
deleteAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync
boolean add(V value, long ttl, TimeUnit unit)
key
- value
- ttl
- - time to live for key\value entry.
If 0
then stores infinitely.unit
- true
if value has been added. false
if value already been in collection.int size()
Copyright © 2014–2016. All rights reserved.