Package org.redisson.api
Interface RTimeSeries<V>
-
- All Superinterfaces:
Iterable<V>
,RDestroyable
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RTimeSeriesAsync<V>
- All Known Implementing Classes:
RedissonTimeSeries
public interface RTimeSeries<V> extends RExpirable, Iterable<V>, RTimeSeriesAsync<V>, RDestroyable
Redis based time-series collection.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(long timestamp, V object)
Adds element to this time-series collection by specifiedtimestamp
.void
add(long timestamp, V object, long timeToLive, TimeUnit timeUnit)
Adds element to this time-series collection by specifiedtimestamp
.void
addAll(Map<Long,V> objects)
Adds all elements contained in the specified map to this time-series collection.void
addAll(Map<Long,V> objects, long timeToLive, TimeUnit timeUnit)
Adds all elements contained in the specified map to this time-series collection.Collection<TimeSeriesEntry<V>>
entryRange(long startTimestamp, long endTimestamp)
Returns ordered entries of this time-series collection within timestamp range.Collection<TimeSeriesEntry<V>>
entryRangeReversed(long startTimestamp, long endTimestamp)
Returns entries of this time-series collection in reverse order within timestamp range.V
first()
Returns the head element ornull
if this time-series collection is empty.Collection<V>
first(int count)
Returns the head elements of this time-series collection.Long
firstTimestamp()
Returns timestamp of the head timestamp ornull
if this time-series collection is empty.V
get(long timestamp)
Returns object by specifiedtimestamp
ornull
if it doesn't exist.Iterator<V>
iterator(int count)
Returns an iterator over elements in this time-series collection.V
last()
Returns the tail element ornull
if this time-series collection is empty.Collection<V>
last(int count)
Returns the tail elements of this time-series collection.Long
lastTimestamp()
Returns timestamp of the tail element ornull
if this time-series collection is empty.V
pollFirst()
Removes and returns the head element ornull
if this time-series collection is empty.Collection<V>
pollFirst(int count)
Removes and returns the head elements ornull
if this time-series collection is empty.V
pollLast()
Removes and returns the tail element ornull
if this time-series collection is empty.Collection<V>
pollLast(int count)
Removes and returns the tail elements ornull
if this time-series collection is empty.Collection<V>
range(long startTimestamp, long endTimestamp)
Returns ordered elements of this time-series collection within timestamp range.Collection<V>
rangeReversed(long startTimestamp, long endTimestamp)
Returns elements of this time-series collection in reverse order within timestamp range.boolean
remove(long timestamp)
Removes object by specifiedtimestamp
.int
removeRange(long startTimestamp, long endTimestamp)
Removes values within timestamp range.int
size()
Returns size of this set.Stream<V>
stream()
Returns stream of elements in this time-series collection.Stream<V>
stream(int count)
Returns stream of elements in this time-series collection.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.redisson.api.RDestroyable
destroy
-
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.RTimeSeriesAsync
addAllAsync, addAllAsync, addAsync, addAsync, entryRangeAsync, entryRangeReversedAsync, firstAsync, firstAsync, firstTimestampAsync, getAsync, lastAsync, lastAsync, lastTimestampAsync, pollFirstAsync, pollFirstAsync, pollLastAsync, pollLastAsync, rangeAsync, rangeReversedAsync, removeAsync, removeRangeAsync, sizeAsync
-
-
-
-
Method Detail
-
add
void add(long timestamp, V object)
Adds element to this time-series collection by specifiedtimestamp
.- Parameters:
timestamp
- - object timestampobject
- - object itself
-
addAll
void addAll(Map<Long,V> objects)
Adds all elements contained in the specified map to this time-series collection. Map contains of timestamp mapped by object.- Parameters:
objects
- - map of elements to add
-
add
void add(long timestamp, V object, long timeToLive, TimeUnit timeUnit)
Adds element to this time-series collection by specifiedtimestamp
.- Parameters:
timestamp
- - object timestampobject
- - object itselftimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval
-
addAll
void addAll(Map<Long,V> objects, long timeToLive, TimeUnit timeUnit)
Adds all elements contained in the specified map to this time-series collection. Map contains of timestamp mapped by object.- Parameters:
objects
- - map of elements to addtimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval
-
size
int size()
Returns size of this set.- Returns:
- size
-
get
V get(long timestamp)
Returns object by specifiedtimestamp
ornull
if it doesn't exist.- Parameters:
timestamp
- - object timestamp- Returns:
- object
-
remove
boolean remove(long timestamp)
Removes object by specifiedtimestamp
.- Parameters:
timestamp
- - object timestamp- Returns:
true
if an element was removed as a result of this call
-
pollFirst
Collection<V> pollFirst(int count)
Removes and returns the head elements ornull
if this time-series collection is empty.- Parameters:
count
- - elements amount- Returns:
- the head element,
or
null
if this time-series collection is empty
-
pollLast
Collection<V> pollLast(int count)
Removes and returns the tail elements ornull
if this time-series collection is empty.- Parameters:
count
- - elements amount- Returns:
- the tail element or
null
if this time-series collection is empty
-
pollFirst
V pollFirst()
Removes and returns the head element ornull
if this time-series collection is empty.- Returns:
- the head element,
or
null
if this time-series collection is empty
-
pollLast
V pollLast()
Removes and returns the tail element ornull
if this time-series collection is empty.- Returns:
- the tail element or
null
if this time-series collection is empty
-
last
V last()
Returns the tail element ornull
if this time-series collection is empty.- Returns:
- the tail element or
null
if this time-series collection is empty
-
first
V first()
Returns the head element ornull
if this time-series collection is empty.- Returns:
- the head element or
null
if this time-series collection is empty
-
firstTimestamp
Long firstTimestamp()
Returns timestamp of the head timestamp ornull
if this time-series collection is empty.- Returns:
- timestamp or
null
if this time-series collection is empty
-
lastTimestamp
Long lastTimestamp()
Returns timestamp of the tail element ornull
if this time-series collection is empty.- Returns:
- timestamp or
null
if this time-series collection is empty
-
last
Collection<V> last(int count)
Returns the tail elements of this time-series collection.- Parameters:
count
- - elements amount- Returns:
- the tail elements
-
first
Collection<V> first(int count)
Returns the head elements of this time-series collection.- Parameters:
count
- - elements amount- Returns:
- the head elements
-
removeRange
int removeRange(long startTimestamp, long endTimestamp)
Removes values within timestamp range. Including boundary values.- Parameters:
startTimestamp
- - start timestampendTimestamp
- - end timestamp- Returns:
- number of removed elements
-
range
Collection<V> range(long startTimestamp, long endTimestamp)
Returns ordered elements of this time-series collection within timestamp range. Including boundary values.- Parameters:
startTimestamp
- - start timestampendTimestamp
- - end timestamp- Returns:
- elements collection
-
rangeReversed
Collection<V> rangeReversed(long startTimestamp, long endTimestamp)
Returns elements of this time-series collection in reverse order within timestamp range. Including boundary values.- Parameters:
startTimestamp
- - start timestampendTimestamp
- - end timestamp- Returns:
- elements collection
-
entryRange
Collection<TimeSeriesEntry<V>> entryRange(long startTimestamp, long endTimestamp)
Returns ordered entries of this time-series collection within timestamp range. Including boundary values.- Parameters:
startTimestamp
- - start timestampendTimestamp
- - end timestamp- Returns:
- elements collection
-
entryRangeReversed
Collection<TimeSeriesEntry<V>> entryRangeReversed(long startTimestamp, long endTimestamp)
Returns entries of this time-series collection in reverse order within timestamp range. Including boundary values.- Parameters:
startTimestamp
- - start timestampendTimestamp
- - end timestamp- Returns:
- elements collection
-
stream
Stream<V> stream()
Returns stream of elements in this time-series collection. Elements are loaded in batch. Batch size is 10.- Returns:
- stream of elements
-
stream
Stream<V> stream(int count)
Returns stream of elements in this time-series collection. Elements are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of elements batch- Returns:
- stream of elements
-
-