trait Connection extends AnyRef
- Alphabetic
- By Inheritance
- Connection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def auth(password: String): ZIO[Redis, RedisError, Unit]
Authenticates the current connection to the server in two cases:
Authenticates the current connection to the server in two cases:
- If the Redis server is password protected via the the requirepass option
- If a Redis 6.0 instance, or greater, is using the Redis ACL system. In this case it is assumed that the implicit username is default.
- password
the password used to authenticate the connection
- returns
if the password provided via AUTH matches the password in the configuration file, the Unit value is returned and the server starts accepting commands. Otherwise, an error is returned and the client needs to try a new password.
- final def clientCaching(track: Boolean): ZIO[Redis, RedisError, Unit]
Controls the tracking of the keys in the next command executed by the connection, when tracking is enabled in Optin or Optout mode.
Controls the tracking of the keys in the next command executed by the connection, when tracking is enabled in Optin or Optout mode.
- track
specifies whether to enable the tracking of the keys in the next command or not
- returns
the Unit value.
- final def clientGetName: ZIO[Redis, RedisError, Option[String]]
Returns the name of the current connection as set by clientSetName
Returns the name of the current connection as set by clientSetName
- returns
the connection name, or None if a name wasn't set.
- final def clientGetRedir: ZIO[Redis, RedisError, redis.ClientTrackingRedirect]
Returns the client ID we are redirecting our tracking notifications to
Returns the client ID we are redirecting our tracking notifications to
- returns
the client ID if the tracking is enabled and the notifications are being redirected
- final def clientId: ZIO[Redis, RedisError, Long]
Returns the ID of the current connection.
Returns the ID of the current connection. Every connection ID has certain guarantees:
- It is never repeated, so if clientID returns the same number, the caller can be sure that the underlying client did not disconnect and reconnect the connection, but it is still the same connection.
- The ID is monotonically incremental. If the ID of a connection is greater than the ID of another connection, it is guaranteed that the second connection was established with the server at a later time.
- returns
the ID of the current connection.
- final def clientKill(filters: redis.ClientKillFilter*): ZIO[Redis, RedisError, Long]
Closes client connections with the specified filters.The following filters are available:
Closes client connections with the specified filters.The following filters are available:
- Address(ip, port). Kill all clients connected to specified address
- LocalAddress(ip, port). Kill all clients connected to specified local (bind) address
- Id(id). Allows to kill a client by its unique ID field. Client ID's are retrieved using the CLIENT LIST command
- ClientType, where the type is one of normal, master, replica and pubsub. This closes the connections of all the clients in the specified class. Note that clients blocked into the MONITOR command are considered to belong to the normal class
- User(username). Closes all the connections that are authenticated with the specified ACL username, however it returns an error if the username does not map to an existing ACL user
- SkipMe(skip). By default this option is set to yes, that is, the client calling the command will not get killed, however setting this option to no will have the effect of also killing the client calling the command It is possible to provide multiple filters at the same time. The command will handle multiple filters via logical AND
- filters
the specified filters for killing clients
- returns
the number of clients killed.
- final def clientKill(address: redis.Address): ZIO[Redis, RedisError, Unit]
Closes a given client connection with the specified address
Closes a given client connection with the specified address
- address
the address of the client to kill
- returns
the Unit value.
- final def clientPause(timeout: zio.Duration, mode: Option[redis.ClientPauseMode] = None): ZIO[Redis, RedisError, Unit]
Able to suspend all the Redis clients for the specified amount of time (in milliseconds).
Able to suspend all the Redis clients for the specified amount of time (in milliseconds). Currently supports two modes:
- All: This is the default mode. All client commands are blocked
- Write: Clients are only blocked if they attempt to execute a write command
- timeout
the length of the pause in milliseconds
- mode
option to specify the client pause mode
- returns
the Unit value.
- final def clientSetName(name: String): ZIO[Redis, RedisError, Unit]
Assigns a name to the current connection
Assigns a name to the current connection
- name
the name to be assigned
- returns
the Unit value.
- final def clientTrackingInfo: ZIO[Redis, RedisError, redis.ClientTrackingInfo]
Returns information about the current client connection's use of the server assisted client side caching feature
Returns information about the current client connection's use of the server assisted client side caching feature
- returns
tracking information.
- final def clientTrackingOff: ZIO[Redis, RedisError, Unit]
Disables the tracking feature of the Redis server, that is used for server assisted client side caching
Disables the tracking feature of the Redis server, that is used for server assisted client side caching
- returns
the Unit value.
- final def clientTrackingOn(redirect: Option[Long] = None, trackingMode: Option[redis.ClientTrackingMode] = None, noLoop: Boolean = false, prefixes: Set[String] = Set.empty): ZIO[Redis, RedisError, Unit]
Enables the tracking feature of the Redis server, that is used for server assisted client side caching.
Enables the tracking feature of the Redis server, that is used for server assisted client side caching. The feature will remain active in the current connection for all its life, unless tracking is turned off with clientTrackingOff
- redirect
the ID of the connection we want to send invalidation messages to
- trackingMode
the mode used for tracking
- noLoop
no loop option
- prefixes
the prefixes registered
- returns
the Unit value.
- final def clientUnblock(clientId: Long, error: Option[redis.UnblockBehavior] = None): ZIO[Redis, RedisError, Boolean]
Unblocks, from a different connection, a client blocked in a blocking operation
Unblocks, from a different connection, a client blocked in a blocking operation
- clientId
the ID of the client to unblock
- error
option to specify the unblocking behavior
- returns
true if the client was unblocked successfully, or false if the client wasn't unblocked.
- final def clientUnpause: ZIO[Redis, RedisError, Unit]
Resumes command processing for all clients that were paused by clientPause
Resumes command processing for all clients that were paused by clientPause
- returns
the Unit value.
- final def echo(message: String): ZIO[Redis, RedisError, String]
Echoes the given string.
Echoes the given string.
- message
the message to be echoed
- returns
the message.
- final def ping(message: Option[String] = None): ZIO[Redis, RedisError, String]
Pings the server.
Pings the server.
- message
the optional message to receive back from server
- returns
PONG if no argument is provided, otherwise return a copy of the argument as a bulk. This command is often used to test if a connection is still alive, or to measure latency.
- final def quit: ZIO[Redis, RedisError, Unit]
Ask the server to close the connection.
Ask the server to close the connection. The connection is closed as soon as all pending replies have been written to the client
- returns
the Unit value.
- final def reset: ZIO[Redis, RedisError, Unit]
Performs a full reset of the connection's server-side context, mimicking the effects of disconnecting and reconnecting again
Performs a full reset of the connection's server-side context, mimicking the effects of disconnecting and reconnecting again
- returns
the Unit value.
- final def select(index: Long): ZIO[Redis, RedisError, Unit]
Changes the database for the current connection to the database having the specified numeric index.
Changes the database for the current connection to the database having the specified numeric index. The currently selected database is a property of the connection; clients should track the selected database and re-select it on reconnection.
- index
the database index. The index is zero-based. New connections always use the database 0
- returns
the Unit value.