RedisConnector class

A base class for Redis connectors.

Inheritance

Constructors

RedisConnector.new(RedisOptions options)

Properties

commandQueue DoubleLinkedQueue<QueuedRedisCommand>
Commands that have been sent to the Redis server but have not yet been responded to. Commands sent to Redis are responded to in the order they are sent so we queue them up here and remove the last item in the queue when a response is received.
final
first Future<RedisConnectionStateChange>
The first element of this stream.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isBroadcast bool
Whether this stream is a broadcast stream.
no setterinherited
isEmpty Future<bool>
Whether this stream contains any elements.
no setterinherited
last Future<RedisConnectionStateChange>
The last element of this stream.
no setterinherited
length Future<int>
The number of elements in this stream.
no setterinherited
options RedisOptions
The underlying options for the Redis connector.
final
parser ↔ RedisParser?
Parser for the Redis protocol to use on this connection only.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single Future<RedisConnectionStateChange>
The single element of this stream.
no setterinherited
socket Socket?
Underlying socket connection to the Redis server.
getter/setter pair
state RedisConnectionState
The current connection state of this connector. RedisConnectionState.closed is the initial state before any connection is attempted.
getter/setter pair
subscriptions List<String>
Redis Pub/Sub channels this connection is currently subscribed to. If not empty then this connection is in a Pub/Sub mode. If empty then this connection is not in a Pub/Sub mode.
final

Methods

any(bool test(RedisConnectionStateChange element)) Future<bool>
Checks whether test accepts any element provided by this stream.
inherited
asBroadcastStream({void onListen(StreamSubscription<RedisConnectionStateChange> subscription)?, void onCancel(StreamSubscription<RedisConnectionStateChange> subscription)?}) Stream<RedisConnectionStateChange>
Returns a multi-subscription stream that produces the same events as this.
inherited
asyncExpand<E>(Stream<E>? convert(RedisConnectionStateChange event)) Stream<E>
Transforms each element into a sequence of asynchronous events.
inherited
asyncMap<E>(FutureOr<E> convert(RedisConnectionStateChange event)) Stream<E>
Creates a new stream with each data event of this stream asynchronously mapped to a new event.
inherited
cast<R>() Stream<R>
Adapt this stream to be a Stream<R>.
inherited
close() Future<void>
Gracefully closes the connection to the Redis server.
closeWithError(Object? possibleError, [StackTrace? stackTrace]) Future<void>
Closes the connection with an error.
connect() Future<RedisConnectionInfo>
Connects to the Redis server. Returns an Future that completes when the connection is established. If the connection fails, the Future completes with an error.
contains(Object? needle) Future<bool>
Returns whether needle occurs in the elements provided by this stream.
inherited
distinct([bool equals(RedisConnectionStateChange previous, RedisConnectionStateChange next)?]) Stream<RedisConnectionStateChange>
Skips data events if they are equal to the previous data event.
inherited
drain<E>([E? futureValue]) Future<E>
Discards all data on this stream, but signals when it is done or an error occurred.
inherited
elementAt(int index) Future<RedisConnectionStateChange>
Returns the value of the indexth data event of this stream.
inherited
every(bool test(RedisConnectionStateChange element)) Future<bool>
Checks whether test accepts all elements provided by this stream.
inherited
expand<S>(Iterable<S> convert(RedisConnectionStateChange element)) Stream<S>
Transforms each element of this stream into a sequence of elements.
inherited
firstWhere(bool test(RedisConnectionStateChange element), {RedisConnectionStateChange orElse()?}) Future<RedisConnectionStateChange>
Finds the first element of this stream matching test.
inherited
fold<S>(S initialValue, S combine(S previous, RedisConnectionStateChange element)) Future<S>
Combines a sequence of values by repeatedly applying combine.
inherited
forEach(void action(RedisConnectionStateChange element)) Future<void>
Executes action on each element of this stream.
inherited
handleError(Function onError, {bool test(dynamic error)?}) Stream<RedisConnectionStateChange>
Creates a wrapper Stream that intercepts some errors from this stream.
inherited
handleRedisErrorReponse(String response, {bool skip = false}) → void
Handles a Redis command error response returned from the parser. Custom connectors can override this method to handle errors themselves and add the skip parameter to skip default error handling logic when calling super.handleRedisErrorReponse - otherwise default error handling logic will apply when calling super.handleRedisErrorReponse.
handleRedisOkReponse(Object? response, {bool skip = false}) → void
Handles a Redis command success/ok response returned from the parser. Custom connectors can override this method to handle responses themselves and add the skip parameter to skip default response handling logic when calling super.handleRedisOkReponse - otherwise default response handling logic will apply when calling super.handleRedisOkReponse.
join([String separator = ""]) Future<String>
Combines the string representation of elements into a single string.
inherited
lastWhere(bool test(RedisConnectionStateChange element), {RedisConnectionStateChange orElse()?}) Future<RedisConnectionStateChange>
Finds the last element in this stream matching test.
inherited
listen(void onData(RedisConnectionStateChange value)?, {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<RedisConnectionStateChange>
Adds a subscription to this stream.
inherited
map<S>(S convert(RedisConnectionStateChange event)) Stream<S>
Transforms each element of this stream into a new stream event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pipe(StreamConsumer<RedisConnectionStateChange> streamConsumer) Future
Pipes the events of this stream into streamConsumer.
inherited
reduce(RedisConnectionStateChange combine(RedisConnectionStateChange previous, RedisConnectionStateChange element)) Future<RedisConnectionStateChange>
Combines a sequence of values by repeatedly applying combine.
inherited
scan(String scanCommand, {int? count, String? type, String? match}) Stream<String>
Stream Redis SCAN values, e.g. Redis keys via the SCAN command. See https://redis.io/commands/scan for more information.
send<T extends Object?>(String command, {List<Object?>? args}) Future<RedisReply<T>>
Sends a command to the Redis server and returns a Future that completes with the response.
setConnectionState(RedisConnectionState state) → void
Sets the current connection state and emits a state change. You probably shouldn't call this directly unless your Redis Client needs to change state explicitly itself.
singleWhere(bool test(RedisConnectionStateChange element), {RedisConnectionStateChange orElse()?}) Future<RedisConnectionStateChange>
Finds the single element in this stream matching test.
inherited
skip(int count) Stream<RedisConnectionStateChange>
Skips the first count data events from this stream.
inherited
skipWhile(bool test(RedisConnectionStateChange element)) Stream<RedisConnectionStateChange>
Skip data events from this stream while they are matched by test.
inherited
subscribeToMessages({required String channelOrPattern, required String subscribeCommand, required String unsubscribeCommand}) Stream<List<Object?>>
Receive a Stream of Redis Pub/Sub messages. See https://redis.io/topics/pubsub for more information on commands
take(int count) Stream<RedisConnectionStateChange>
Provides at most the first count data events of this stream.
inherited
takeWhile(bool test(RedisConnectionStateChange element)) Stream<RedisConnectionStateChange>
Forwards data events while test is successful.
inherited
timeout(Duration timeLimit, {void onTimeout(EventSink<RedisConnectionStateChange> sink)?}) Stream<RedisConnectionStateChange>
Creates a new stream with the same events as this stream.
inherited
toList() Future<List<RedisConnectionStateChange>>
Collects all elements of this stream in a List.
inherited
toSet() Future<Set<RedisConnectionStateChange>>
Collects the data of this stream in a Set.
inherited
toString() String
A string representation of this object.
inherited
transform<S>(StreamTransformer<RedisConnectionStateChange, S> streamTransformer) Stream<S>
Applies streamTransformer to this stream.
inherited
where(bool test(RedisConnectionStateChange event)) Stream<RedisConnectionStateChange>
Creates a new stream from this stream that discards some elements.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited