org.redisson.api.RLexSortedSetAsync Maven / Gradle / Ivy
Show all versions of redisson-all Show documentation
/**
* Copyright (c) 2013-2024 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.api;
import java.util.Collection;
/**
* Async interface for sorted set contained values of String type.
*
* @author Nikita Koksharov
*
*/
public interface RLexSortedSetAsync extends RCollectionAsync {
/**
* Removes and returns the tail element or {@code null} if this sorted set is empty.
*
* @return the tail element or {@code null} if this sorted set is empty
*/
RFuture pollLastAsync();
/**
* Removes and returns the head element or {@code null} if this sorted set is empty.
*
* @return the head element,
* or {@code null} if this sorted set is empty
*/
RFuture pollFirstAsync();
/**
* Returns the first element.
*
* @return element
*/
RFuture firstAsync();
/**
* Returns the last element.
*
* @return element
*/
RFuture lastAsync();
/**
* Read all values at once.
*
* @return collection of values
*/
RFuture> readAllAsync();
/**
* Removes values range starting with fromElement
and ending with toElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return number of elements removed
*/
RFuture removeRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive);
/**
* Removes tail values range starting with fromElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @return number of elements removed
*/
RFuture removeRangeTailAsync(String fromElement, boolean fromInclusive);
/**
* Removes head values range ending with toElement
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return number of elements removed
*/
RFuture removeRangeHeadAsync(String toElement, boolean toInclusive);
/**
* Returns the number of tail values starting with fromElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @return number of elements
*/
RFuture countTailAsync(String fromElement, boolean fromInclusive);
/**
* Returns the number of head values ending with toElement
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return number of elements
*/
RFuture countHeadAsync(String toElement, boolean toInclusive);
/**
* Returns tail values range starting with fromElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @return collection of elements
*/
RFuture> rangeTailAsync(String fromElement, boolean fromInclusive);
/**
* Returns head values range ending with toElement
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return collection of elements
*/
RFuture> rangeHeadAsync(String toElement, boolean toInclusive);
/**
* Returns values range starting with fromElement
and ending with toElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return collection of elements
*/
RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive);
/**
* Returns tail values range starting with fromElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count);
/**
* Returns head values range ending with toElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeHeadAsync(String toElement, boolean toInclusive, int offset, int count);
/**
* Returns values range starting with fromElement
and ending with toElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count);
/**
* Returns tail values range in reverse order starting with fromElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @return collection of elements
*/
RFuture> rangeTailReversedAsync(String fromElement, boolean fromInclusive);
/**
* Returns head values range in reverse order ending with toElement
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return collection of elements
*/
RFuture> rangeHeadReversedAsync(String toElement, boolean toInclusive);
/**
* Returns values range in reverse order starting with fromElement
and ending with toElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return collection of elements
*/
RFuture> rangeReversedAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive);
/**
* Returns tail values range in reverse order starting with fromElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeTailReversedAsync(String fromElement, boolean fromInclusive, int offset, int count);
/**
* Returns head values range in reverse order ending with toElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param toElement - end element
* @param toInclusive - end element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeHeadReversedAsync(String toElement, boolean toInclusive, int offset, int count);
/**
* Returns values range in reverse order starting with fromElement
and ending with toElement
.
* Returned collection limited by count
and starts with offset
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @param offset - offset of result collection
* @param count - amount of result collection
* @return collection of elements
*/
RFuture> rangeReversedAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count);
/**
* Returns the number of elements between fromElement
and toElement
.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @param toElement - end element
* @param toInclusive - end element inclusive
* @return number of elements
*/
RFuture countAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive);
/**
* Returns rank of the element
*
* @param o - element to rank
* @return rank or null
if element does not exist
*/
RFuture rankAsync(String o);
/**
* Returns values by rank range. Indexes are zero based.
* -1
means the highest score, -2
means the second highest score.
*
* @param startIndex - start index
* @param endIndex - end index
* @return collection of elements
*/
RFuture> rangeAsync(int startIndex, int endIndex);
/**
* Returns rank of value, with the scores ordered from high to low.
*
* @param o - value
* @return rank or null
if value does not exist
*/
RFuture revRankAsync(String o);
/**
* Returns random element from this sorted set
*
* Requires Redis 6.2.0 and higher.
*
* @return value
*/
RFuture randomAsync();
/**
* Returns random elements from this sorted set limited by count
*
* Requires Redis 6.2.0 and higher.
*
* @param count - values amount to return
* @return value
*/
RFuture> randomAsync(int count);
/**
* Adds object event listener
*
* @see org.redisson.api.listener.TrackingListener
* @see org.redisson.api.listener.ScoredSortedSetAddListener
* @see org.redisson.api.listener.ScoredSortedSetRemoveListener
* @see org.redisson.api.ExpiredObjectListener
* @see org.redisson.api.DeletedObjectListener
*
* @param listener object event listener
* @return listener id
*/
RFuture addListenerAsync(ObjectListener listener);
}