Class AbstractRedisCollection<E>
java.lang.Object
java.util.AbstractCollection<E>
org.springframework.data.redis.support.collections.AbstractRedisCollection<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BoundKeyOperations<String>,RedisCollection<E>,RedisStore
- Direct Known Subclasses:
DefaultRedisList,DefaultRedisSet,DefaultRedisZSet
public abstract class AbstractRedisCollection<E>
extends AbstractCollection<E>
implements RedisCollection<E>
Base implementation for
RedisCollection. Provides a skeletal implementation. Note that the collection support
works only with normal, non-pipeline/multi-exec connections as it requires a reply to be sent right away.- Author:
- Costin Leau, Christoph Strobl, Mark Paluch
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRedisCollection(String key, RedisOperations<String, E> operations) Constructs a newAbstractRedisCollectioninstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAll(Collection<? extends E> c) protected voidcheckResult(Object obj) booleancontainsAll(Collection<?> c) booleanSets the key time-to-live/expiration.Sets the key time-to-live/expiration.Returns the expiration of this key.getKey()Returns the key associated with this entity.Returns the underlying Redis operations used by the backing implementation.inthashCode()persist()Removes the expiration (if any) of the key.booleanremoveAll(Collection<?> c) voidRenames the key.toString()Methods inherited from class java.util.AbstractCollection
add, clear, contains, isEmpty, iterator, remove, retainAll, size, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
expiration, expire, expireAt, getTypeMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
ENCODING
- See Also:
-
-
Constructor Details
-
AbstractRedisCollection
Constructs a newAbstractRedisCollectioninstance.- Parameters:
key- Redis key of this collection.operations-RedisOperationsfor the value type of this collection.
-
-
Method Details
-
getKey
Description copied from interface:BoundKeyOperationsReturns the key associated with this entity.- Specified by:
getKeyin interfaceBoundKeyOperations<E>- Returns:
- key associated with the implementing entity
-
getOperations
Description copied from interface:RedisStoreReturns the underlying Redis operations used by the backing implementation.- Specified by:
getOperationsin interfaceBoundKeyOperations<E>- Specified by:
getOperationsin interfaceRedisStore- Returns:
- operations never null.
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Overrides:
addAllin classAbstractCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Overrides:
containsAllin classAbstractCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Overrides:
removeAllin classAbstractCollection<E>
-
expire
Description copied from interface:BoundKeyOperationsSets the key time-to-live/expiration.- Specified by:
expirein interfaceBoundKeyOperations<E>- Parameters:
timeout- expiration valueunit- expiration unit- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
expireAt
Description copied from interface:BoundKeyOperationsSets the key time-to-live/expiration.- Specified by:
expireAtin interfaceBoundKeyOperations<E>- Parameters:
date- expiration date- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
getExpire
Description copied from interface:BoundKeyOperationsReturns the expiration of this key.- Specified by:
getExpirein interfaceBoundKeyOperations<E>- Returns:
- expiration value (in seconds). null when used in pipeline / transaction.
-
persist
Description copied from interface:BoundKeyOperationsRemoves the expiration (if any) of the key.- Specified by:
persistin interfaceBoundKeyOperations<E>- Returns:
- true if expiration was removed, false otherwise. null when used in pipeline / transaction.
-
rename
Description copied from interface:BoundKeyOperationsRenames the key.
Note: The new name for empty collections will be propagated on add of first element.- Specified by:
renamein interfaceBoundKeyOperations<E>- Parameters:
newKey- new key. Must not be null.
-
equals
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
toString
- Overrides:
toStringin classAbstractCollection<E>
-
checkResult
-